开发板上调试成功了,在proteus中仿真不出来,如图
#include<reg52.h>
#define uchar unsigned char
uchar code table1[]="I love you!";
uchar code table2[]="I want you!";
sbit dual=P2^6;
sbit weal=P2^7;
sbit lcdrs=P3^5;
sbit lcded=P3^4;
void delay(int xms)
{
int i,j;
for(i=xms;i>0;i--)
for(j=110;j>0;j--);
}
void write_com(uchar com )
{
lcdrs=0;
P0=com;
delay(5);
lcded=1;
delay(5);
lcded=0;
}
void write_date(uchar date)
{
lcdrs=1;
P0=date;
delay(5);
lcded=1;
delay(5);
lcded=0;
}
void init()
{
dual=0;
weal=0;
lcded=0;
write_com(0x38);
write_com(0x0c);
write_com(0x06);
write_com(0x01);
}
void main()
{
int a,b;
init();
write_com(0x80);
for(a=0;a<11;a++)
{
write_date(table1[a]);
delay(5);
}
write_com(0x80+0x40);
for(b=0;b<11;b++)
{
write_date(table2);
delay(5);
}
while(1);
}
|