#include <>
sbit RS=P2^6;
sbit rw=P2^5;
sbit LCDE=P2^7;
unsigned char n;
unsigned char shi,ge,fen,miao,count;
unsigned int year,yue,ri;
//unsigned char code table[]=" 2011-8-4 MON ";
void delay(unsigned int xms)
{
unsigned int i,j;
for(i=xms;i>0;i--)
for(j=110;j>0;j--);
}
void (unsigned )
{
RS=0;
rw=0;
LCDE=0;
;
delay(5);
LCDE=1;
delay(5);
LCDE=0;
}
void write_date(unsigned char date)
{
RS=1;
rw=0;
LCDE=0;
P0=date;
delay(5);
LCDE=1;
delay(5);
LCDE=0;
}
void write_sfm(unsigned char add,unsigned char date)
{
unsigned char shi,ge;
shi=date/10;
ge=date%10;
(0x80+0x40+add);
write_date(shi+0x30);
write_date(ge+0x30);
}
void write_n(unsigned int add1,unsigned int date1)
{
unsigned int q,b,s,g;
q=date1/1000;
b=date1/100%10;
s=date1/10%10;
g=date1%10;
(0x80+add1);
write_date(q+0x30);
write_date(b+0x30);
write_date(s+0x30);
write_date(g+0x30);
}
void write_yr(unsigned char add2,unsigned char date2)
{
unsigned char s1,g1;
s1=date2/10;
g1=date2%10;
(0x80+add2);
write_date(s1+0x30);
write_date(g1+0x30);
}
void init()
{
LCDE=0;
fen=35;
miao=34;
shi=15;
ri=4;
yue=8;
year=2011;
(0x38);
(0x0c);
(0x06);
(0x01);
(0x80+7);
write_date('-');
delay(5);
(0x80+10);
write_date('-');
write_n(3,year);
write_yr(8,yue);
write_yr(11,ri);
delay(5);
(0x80
LCD液晶万年历显示程序 来自淘豆网www.taodocs.com转载请标明出处.