#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar code table[]={"200613"};
uchar code table1[]={" wlcome"};
sbit RS=P1^0;//定义引脚
sbit RW=P1^1;
sbit E=P1^2;
uchar numb,numb1;
void delyms(uint z)
{
uint i,j;
for(i=z;i>0;i--)
for(j=110;j>0;j--);
}
void writecom(uchar com)
{
RS=0;
RW=0;
P0=com;
delyms(5);
E=0;
delyms(5);
E=1;
}
void writedate(uchar date)
{
RS=1;
RW=0;
P0=date;
delyms(5);
E=1;
delyms(5);
E=0;
}
void init()
{
E=0;
writecom(0x38);
writecom(0x0f);
writecom(0x06);
writecom(0x01);
}
void main()
{
init();
writecom(0x80+0x03);
for(numb=0;numb<6;numb++)
{
writedate(table[numb]);
delyms(500);
}
writecom(0x80+0x43);#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar code table[]={"200613"};
uchar code table1[]={" wlcome"};
sbit RS=P1^0;//定义引脚
sbit RW=P1^1;
sbit E=P1^2;
uchar numb,numb1;
void delyms(uint z)
{
uint i,j;
for(i=z;i>0;i--)
for(j=110;j>0;j--);
}
void writecom(uchar com)
{
RS=0;
RW=0;
P0=com;
delyms(5);
E=0;
delyms(5);
E=1;
}
void writedate(uchar date)
{
RS=1;
RW=0;
P0=date;
delyms(5);
E=1;
delyms(5);
E=0;
}
void init()
{
E=0;
writecom(0x38);
writecom(0x0f);
writecom(0x06);
writecom(0x01);
}
void main()
{
init();
writecom(0x80+0x03);
for(numb=0;numb<6;numb++)
{
writedate(table[numb]);
delyms(500);
}
writecom(0x80+0x43);
for(numb=0;numb<8;numb++)
{
writedate(table1[numb]);
delyms(5);
}
while(1);
} |