1、#includeunsigned char kk,a,i,j,k,l,h,g,f;unsigned char table110 = 0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90;unsigned char table210 = 0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90;unsigned char table310 = 0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90;unsigned char table410 = 0xc0,0xf9
2、,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90;unsigned char table510 = 0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90;unsigned char table610 = 0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90;unsigned char table76=0xf9,0xa4,0x99,0xa4,0x92,0xa4;/显示初始时间unsigned char table8=0x80,0x40,0x20,0x10,0x08,0x04
3、;sbit led7=P27;sbit led6=P26;sbit led5=P25;sbit led4=P24;sbit led3=P23;sbit led2=P22;void main()TMOD=0x01;/00000001TH0=(65536-50000)/256; /设置初值TL0=(65536-50000)%256;EA=1; / 打开中总中断开关ET0=1; /打开定时器中断TR0=1;i=0;j=1;k=1;l=1;h=1;g=1; /a=0xfe; P2=0; /*P0=table70;P2=table80;P2=0;P0=table71;P2=table81;P2=0;P0
4、=table72;P2=table82;P2=0;P0=table73;P2=table83;P2=0;P0=table74;P2=table84;P2=0;P0=table75;P2=table85;*/ while(1) if(kk=20) P2=0; kk=0;P0=table1i;led7=1;/led7=0;i+;P2=0;if(i=9) i=0;P0=table2j;led6=1; j+;P2=0;if(j=6)j=1;P0=table3k;led5=1;/P0=0x01;/这里让小数点亮k+; P2=0;if(k=9)k=0;P0=table4l;led4=1;l+; P2=0;if(l=6)l=0;P0=table5h;led3=1;h+;P2=0;if(h=4)h=0;P0=table6g;led2=1;g+;if(g=2)g=0; void timer0() interrupt 1TH0=(65536-50000)/256; /设置初值TL0=(65536-50000)%256;kk+;