#include<reg52.h> //时钟
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^6;
sbit wela=P2^7;
sbit rs=P3^5;
sbit lcden=P3^4;
sbit s1=P3^3;
sbit s2=P3^1;
sbit s3=P3^2;
sbit rd=P3^7;
uchar code table[]=" 2012-12-30 SUN";
uchar code table1[]=" 23:59:50";
uchar count,s1num;
char shi=23,fen=59,miao=50,week;
char year=12,month=12,day=30;
void delay(uchar z)
{
uchar x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void write_com(uchar com) //写指令函数
{
rs=0;
lcden=0;
P0=com;
delay(5);
lcden=1;
delay(5);
lcden=0;
}
void write_date(uchar date) //写数据函数
{
rs=1;
lcden=0;
P0=date;
delay(5);
lcden=1;
delay(5);
lcden=0;
}
void init() //初始化
{
uchar num;
dula=0; //关闭数码管
wela=0;
lcden=0;
write_com(0x38);
write_com(0x0c);
write_com(0x06);
write_com(0x01);
write_com(0x80);
for(num=0;num<16;num++)
{