#include<reg51.h>
sbit lcde=P2^7;
sbit rw=P2^5;
sbit rs=P2^6;
#define uint unsigned int
#define uchar unsigned char
void delay();
char yi[14]="zheng peng dan";
char er[13]="love me ha ha";
void main()
{
char i;
init();
lcdwritecom(0x80);
for(i=0;i<14;i++)
{
lcdwritedate(yi[14]);
delay(5);
}
lcdwritecom(0x80+0x40);
for(i=0;i<13;i++)
{
lcdwritedate(er[13]);
delay(5);
}
while(1);
}
void init()
{
lcdwritecom(0x38);
lcdwritecom(0x0c);
lcdwritecom(0x06);
lcdwritecom(0x01);
lcdwritecom(0x80);
}
void lcdwritecom(char com)
{
rs=0;
rw=0;
lcd=com;
delay(10);
lcde=1;
delay(10);
lcde=0;
}
void lcdwritedate(char date)
{
rs=1;
rw=0;
lcd=date;
delay(10);
lcde=1;
delay(10);
lcde=0;
}
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>