#include<reg52.h>
sbit RS=P3^5;
sbit RW=P3^6;
sbit EN=P3^4;
#define uchar unsigned char
#define uint unsigned int
void Read_state()
{
uchar busy;
P0=0xff;
RS=0;
RW=1;
do
{
EN=1;
busy=P0;
EN=0;
}while(busy & 0x80);
}
void Write_order(uint cmd)
{
Read_state();
RS=0;
RW=0;
P0=cmd;
EN=1;
EN=0;
}
void Write_data(uint dat)
{
Read_state();
RS=1;
RW=0;
P0=dat;
EN=1;
EN=0;
}
void main()
{
uchar *a[]={"Junday ","Monday "," Tuesday ","Wednesday ","Thursday ","Friday ","Saturday "};
uchar *pa;
uint i,k=1000;
Write_order(0x38);
Write_order(0x0c);
Write_order(0x01);
Write_order(0x07);
Write_order(0x80|0x10);
for(i=0;i<7;i++)
{
pa=a[i];
while(*pa!='\0')
{
Write_data(*pa++);
while(k--);
}
k=1000;
}
while(1);
}