lcd驱动编写代码

 

//lcd.h //By 小E VER 0.1 QQ592646022 #define u16 unsigned int #define u8 unsigned char //LCD ADDR #define WRITECMD 0 #define READCMD 2 #define WRITEDATA 1 #define READDATA 3 //LCD REG #define LCDCLS 1 #define LCDHOME 2 #define LCDVISIBLE 8 #define LCDRESET 0x38 #define LCDSETMODE 4 #define LCDSHIFT 16 #define LCDFUCTION 32 #define LCDSETCGADDR 0x40 #define LCDSETDDADDR 0x80 #define LCDCURSORADD 0xe #define LCDCURSORDEC 0xa #define LCDNOCURSORADD 4 #define LCDNOCURSORDEC 0 void lcd_write_cmd(u8 cmd); //写命令 void lcd_write_data(u8 dat); //写数据 void lcd_wait_busy(); //等待不忙 void delay(u16 time); //延时 void lcd_set_xy(u8 x,u8 y); //设置坐标 void lcd_write_string(u8 * pch); //输出字符串 void lcd_write_charxy(u8 ch,u8 x,u8 y); //在坐标(x,y)输出字符 x=列 y=行 void lcd_write_char(u8 ch); //输出字符 void lcd_reset_cursor(); //光标复位 void lcd_cls(); //清屏 bit lcd_is_busy(); //测试是否为忙 返回1忙,0不忙 void lcd_write_cgram(u8 * pcgram); //写cgram数据 //lcd.c #include "lcd.h" #include #include void delay(u16 time){ u16 i; for(i=0;i

//实验结果

 

 

 

 

 

 

你可能感兴趣的:(嵌入式开发)