当前位置:网站首页>Anti electronic ink screen st7302
Anti electronic ink screen st7302
2022-07-26 02:50:00 【Zhuoqing】

§01ST7302 Electronic screen
One 、 Background introduction
This kind of ST7302 It's from TB Purchased , Let's test its characteristics , Accumulate experience for later application .

The test platform adopts ESP32 Module adapter board Using it SPI Interface to test the function of the electronic screen . This module adapter board has hardware and software SPI Interface . application HSPI1, Corresponding to GPIO12,13,14, In addition, reset and data allocation IO, This is the corresponding allocation scheme .


Two 、 Build the test circuit
Build a test circuit on the bread board . This is the pin function description given in the device data manual .



3、 ... and 、 The test program
from machine import Pin,SPI
import time
lcd_spi = SPI(1, 1000000)
lcd_dc = Pin(15, Pin.OUT)
lcd_cs = Pin(2, Pin.OUT)
lcd_res = Pin(27, Pin.OUT)
lcd_cs.on()
lcd_dc.on()
lcd_res.on()
def LCDWriteBus(dat):
lcd_cs.off()
lcd_spi.write(bytes([dat]))
lcd_cs.on()
def LCDWriteData8(dat):
LCDWriteBus(dat)
def LCDWriteData(dat):
datbyte = dat.to_bytes(2, 1)
LCDWriteData8(datbyte[0])
LCDWriteData8(datbyte[1])
def LCDWriteReg(dat):
lcd_dc.off()
LCDWriteBus(dat)
lcd_dc.on()
def LCDAddressSet(x1,y1,x2,y2):
LCDWriteReg(0x2a)
LCDWriteData8(x1+0x19)
LCDWriteData8(x2+0x19)
LCDWriteReg(0x2b)
LCDWriteData8(y1)
LCDWriteData8(y2)
LCDWriteReg(0x2c)
def LCDInit():
lcd_res.off()
time.sleep_ms(100)
lcd_res.on()
time.sleep_ms(400)
LCDWriteReg(0x38)
LCDWriteReg(0xeb)
LCDWriteData8(0x02)
LCDWriteReg(0xd7)
LCDWriteData8(0x68)
LCDWriteReg(0xd1)
LCDWriteData8(0x01)
LCDWriteReg(0xc0)
LCDWriteData8(0x80)
LCDWriteReg(0xc1)
LCDWriteData8(0x28)
LCDWriteData8(0x28)
LCDWriteData8(0x28)
LCDWriteData8(0x28)
LCDWriteData8(0x14)
LCDWriteData8(0x00)
LCDWriteReg(0xc2)
LCDWriteData8(0x00)
LCDWriteData8(0x00)
LCDWriteData8(0x00)
LCDWriteData8(0x00)
LCDWriteReg(0xcb)
LCDWriteData8(0x14)
LCDWriteReg(0xb4)
LCDWriteData8(0xe5)
LCDWriteData8(0x77)
LCDWriteData8(0xf1)
LCDWriteData8(0xff)
LCDWriteData8(0xff)
LCDWriteData8(0x4f)
LCDWriteData8(0xf1)
LCDWriteData8(0xff)
LCDWriteData8(0xff)
LCDWriteData8(0x4f)
LCDWriteReg(0x11)
time.sleep_ms(100)
LCDWriteReg(0xc7)
LCDWriteData8(0xa6)
LCDWriteData8(0xe9)
LCDWriteReg(0xb0)
LCDWriteData8(0x64)
LCDWriteReg(0x36)
LCDWriteData8(0x00)
LCDWriteReg(0x3a)
LCDWriteData8(0x11)
LCDWriteReg(0xb9)
LCDWriteData8(0x23)
LCDWriteReg(0xb8)
LCDWriteData8(0x09)
LCDWriteReg(0x2a)
LCDWriteData8(0x05)
LCDWriteData8(0x36)
LCDWriteReg(0x2b)
LCDWriteData8(0x00)
LCDWriteData8(0xc7)
LCDWriteReg(0xd0)
LCDWriteData8(0x1f)
LCDWriteReg(0x29)
LCDWriteReg(0xb9)
LCDWriteData8(0xe3)
time.sleep_ms(100)
LCDWriteReg(0xb9)
LCDWriteData8(0x23)
LCDWriteReg(0x72)
LCDWriteData8(0x00)
LCDWriteReg(0x39)
LCDWriteReg(0x2a)
LCDWriteReg(0x19)
LCDWriteData8(0x23)
LCDWriteReg(0x2b)
LCDWriteData8(0)
LCDWriteData8(0x7c)
LCDWriteData8(0x2c)
time.sleep_ms(120)
def LCDFill(xsta, ysta, xend, yend, color):
LCDAddressSet(xsta, ysta, xend-1, yend-1)
for _ in range(5000):
LCDWriteData8(color)
LCDInit()
LCDFill(0,0,10,0x7c, 0xf0)
buf = bytes([0x55, 0xa0])
count = 0
while True:
count += 1
time.sleep_ms(100)
■ Links to related literature :
边栏推荐
猜你喜欢

Chapter 3 business function development (delete clues)

DFS Niuke maze problem

【方向盘】使用IDEA的60+个快捷键分享给你,权为了提效(Live Template&Postfix Completion篇)

Self-supervised learning method to solve the inverse problem of Fokker-Planck Equation

What if the test / development programmer gets old? Lingering cruel facts

AMD64(x86_64)架构abi文档:中

从各大APP年度报告看用户画像——标签,比你更懂你自己

EAM系统能帮助企业做什么?

Cycle and branch (I)

图像识别(六)| 激活函数
随机推荐
[translation] announce Vites 13
[steering wheel] tool improvement: common shortcut key set of sublime text 4
循环与分支(一)
Turn on the LED
简单使用 MySQL 索引
Stack Title: the longest absolute path of a file
My friend took 25koffer as soon as he learned automation test. When will my function test end?
AMD64(x86_64)架构abi文档:中
Project management: lean management method
[reading notes] user portrait methodology and engineering solutions
scipy.sparse.csr_ matrix
Simply use MySQL index
朋友刚学完自动化测试就拿25Koffer,我功能测试何时才能到头?
Study notes of pytorch deep learning practice: convolutional neural network (Advanced)
MySQL(4)
How can users create data tables on Web pages and store them in the database
Neo4j import CSV data error: neo4j load CSV error: couldn't load the external resource
Recorded target detection NMS (non maximum suppression)
流形学习、、
AMD64 (x86_64) architecture ABI document: