1、#includereg52.h#define uchar unsigned char#define uint unsigned intunsigned char code table10=0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90;void display(uchar,uchar,uchar,uchar,uchar,uchar);void delayms(uint);uchar num,num1,num2,num3,xs,xg,shi,ge,fs,fg;void main()TMOD=0x01;TH0=(65536-45872)256;T
2、L0=(65536-45872)%256;EA=1;ET0=1;TR0=1;while(1)display(shi,ge,xs,xg,fs,fg);void display(uchar shi,uchar ge,uchar xs,uchar xg,uchar fs,uchar fg)P1=0x01;P0=tablege;delayms(10);P1=0x02;P0=tableshi;delayms(3);P1=0x04;P0=0xbf;delayms(3);P1=0x08;P0=tablexg;delayms(3);P1=0x10;P0=tablexs;delayms(3);P1=0x20;P
3、0=0xbf;delayms(3);P1=0x40;P0=tablefg;delayms(3);P1=0x80;P0=tablefs;delayms(3);void delayms(uint xms) 显示延时uint i,j;for(i=xms;i0;i-)for(j=110;j0;j-);void T0_1time()interrupt 1TH0=(65536-45872)256;TL0=(65536-45872)%256;num+;if(num=20)num=0;num1+;if(num1=60) num1=0;num2+;if(num2=60)num2=0;num3+;if(num3=24)num3=0;fs=num310;fg=num3%10;xs=num210;xiaoshi de shiweixg=num2%10;xiaoshide ge weishi=num110;ge=num1%10;