lcd.h
资源名称:RFID.rar [点击查看]
上传用户:njxy551199
上传日期:2022-04-06
资源大小:1990k
文件大小:1k
源码类别:
RFID编程
开发平台:
C/C++
- #include "reg52.h"
- #include "intrins.h"
- #include "string.h"
- sbit RS=P2^2;
- sbit RW=P2^3;
- sbit EN=P2^4;
- void delay1ms(unsigned int ms)//延时1毫秒
- {unsigned int i,j;
- for(i=0;i<ms;i++)
- for(j=0;j<100;j++);
- }
- void wcom(unsigned char com)//写命令
- {
- RS=0;
- RW=0;
- EN=0;
- P0=com;
- delay1ms(1);
- EN=1;
- delay1ms(1);
- EN=0;
- }
- void wdat(unsigned char dat)//写数据
- {
- RS=1;
- RW=0;
- EN=0;
- P0=dat;
- delay1ms(1);;
- EN=1;
- delay1ms(1);
- EN=0;
- }
- void display(unsigned char *t)//显示//
- {
- while(*t!=' ')
- {
- wdat(*t);
- t++;
- delay1ms(1);
- }
- }
- void lcd_init()//初始化设置
- {
- wcom(0x38) ; //8位数据接口,两行显示,5*7点阵
- wcom(0x80) ; //第一行显示
- wcom(0x06) ; //数据读、写操作,画面不动,AC自动增一
- wcom(0x0c); //开关显示,光标不闪烁
- wcom(0x01) ; //清屏;
- }
- void lcd_display (uchar *str1,uchar *str2 )
- {
- display(str1) ;
- wcom(0x88) ;
- display(str2) ;
- }
- void delay1ms(unsigned int ms);
- void wcom(unsigned char com);
- void wdat(unsigned char dat);
- void display(unsigned char *t);
- void lcd_init();
- void lcd_display (uchar *str1,uchar *str2 ) ;