《51单片机用1602液晶显示数字1》由会员分享,可在线阅读,更多相关《51单片机用1602液晶显示数字1(2页珍藏版)》请在金锄头文库上搜索。
#include#define uchar unsigned char#define uint unsigned intsbit lcden=P34;sbit lcdrs=P35;sbit dula=P26;sbit wela=P27;void delay(uint z)uint x,y;for(x=z;x0;x-)for(y=110;y0;y-);void write_com(uchar com)lcdrs=0;P0=com;delay(5);lcden=1;delay(5);lcden=0;void write_data(uchar date)lcdrs=1;P3=date;P0=date;delay(5);lcden=1;delay(5);lcden=0;void init()dula=0;wela=0;lcden=0;write_com(0x38);write_com(0x0e);write_com(0x06);write_com(0x01);write_com(0x80);void main()init();write_data(0x31);while(1);