LCD12864B --- 12864液晶屏关联功能函数

LCD12864B 模块的主要功能与函数

功能相关函数

LCD12864B.init_12864(self)

液晶屏初始化函数

LCD12864B.qp_12864(self)

清屏函数,清除所有显示信息

LCD12864B.lcd_write_string(self, address, string, s_bit)

显示函数,输入参数address为显示开始地址,string为显示内容,s_bit为显示内容是否为汉字 string的地址范围:80-87,90-97,88-8f,98-9f;显示内容为汉字s_bit设置为2否则设置为1

LCD12864B与开发板接线对应引脚:

TPYBoard LCD12864B
GND GND
VIN VCC
Y2 RS
GND R/W
Y1 E
X1 DB0
X2 DB1
X3 DB2
X4 DB3
X5 DB4
X6 DB5
X7 DB6
X8 DB7
VIN RST
电位器中间 VOUT
3V3 BLA
GND BLK

程序示例:

# main.py -- put your code here!
import pyb
import LCD12864
def main():
      lcd=LCD12864.lcd12864(RS='Y2',E='Y1')           #设置LCD12864功能引脚
      lcd.lcd_write_string(0x82,"MicroPyton",1)
      lcd.lcd_write_string(0x91,"By TurnipSmart",1)
      lcd.lcd_write_string(0x8a,"萝卜电子",2)
      lcd.lcd_write_string(0x9a,"液晶测试 ",2)
      while True:
              a=0


if __name__ == '__main__':
      main()