河北今年实现农村生活垃圾处理体系全覆盖
中新网石家庄4月27日电(赵丹媚)27日,河北省住房和城乡建设厅发布消息称,为提高农村生活垃圾治理水平,2022年,农村生活垃圾收集转运设施
2022-04-28 11:45:22
(资料图)
液晶显示器(LCD)是一种常用的显示屏,在许多电子产品中经常使用它来以文本或图像格式显示信息。LCD用于在其屏幕上显示字母、数字等字符。LCD显示器由8条数据线和3条控制线组成,用于将LCD显示器与8051单片机连接。
考虑使用基于Proteus的模拟LCD与8051单片机的接口是:
如何在LCD显示屏上显示“8051单片机”,案例程序如下:
#include< reg51.h >#define kam P0void lcd_initi();void lcd_dat(unsigned char );void lcd_cmd(unsigned char );void delay();void display(unsigned char *s, unsigned char r)sbit rs=P2^0;sbit rw=P2^1;sbit en=P2^2;void main(){lcd_initi();lcd_cmd(0x80);delay(100);lcd_cmd(0xc0);display("8051单片机",10);while(1);}void display(unsigned char *s, unsigned char r){unsignedint w;for(w=0;w< r;w++){lcd_data(s[w]);}}voidlcd_initi(){lcd_cmd(0x01);delay(100);lcd_cmd(0x38);delay(100);lcd_cmd(0x06);delay(100);lcd_cmd(0x0c);delay(100);}voidlcd_dat(unsigned char dat){kam = dat;rs=1;rw=0;en=1;delay(100);en=0;}}voidlcd_cmd(unsigned char cmd){kam=cmd;rs=0;rw=0;en=1;delay(100);en=0;}void delay( unsigned int n){unsignedint a;for(a=0;a< n;a++);}
标签: