|
|
兩處錯誤!
#include<reg52.h>
sbit CE = P2^7;
sbit RW = P2^5;
sbit RS = P2^6;
unsigned char table[]=
{
0x1F,0x11,0x11,0x1F,0x11,0x11,0x1F,0x00,//日
0x0F,0x09,0x0F,0x09,0x0F,0x09,0x09,0x12,//月
0x04,0x0F,0x12,0x0F,0x0A,0x1F,0x02,0x02,//年
};
void Read_Busy()
{
unsigned char busy;
P0 = 0xff;
RS = 0;
RW = 1;
do{
CE = 1;
busy = P0;
CE = 0;
}while(busy>7);//while(busy>>7);
}
void Write_Cmd(unsigned char cmd)
{
Read_Busy();
RS = 0;
RW = 0;
P0 = cmd;
CE = 1;
CE = 0;
}
void Write_Data(unsigned char dat)
{
Read_Busy();
RS = 1;
RW = 0;
P0 = dat;
CE = 1;
CE = 0;
}
void main()
{
int i;
RW = 0;
Write_Cmd(0x01);//數(shù)據(jù)指針清零 所有顯示清零
Write_Cmd(0x38);//設(shè)置顯示
Write_Cmd(0x0f);//開顯示 光標(biāo)閃爍
Write_Cmd(0x06);//設(shè)置指針 光標(biāo) 不移屏
Write_Cmd(0x41); //Write_Cmd(0x40);
for(i=0;i<24;i++)
{
Write_Data(table);
}
Write_Cmd(0x80);//設(shè)置地址指針
Write_Data(0x00);
Write_Data(0x01);
Write_Data(0x02);
while(1);
}
|
|