#include
#define uchar unsigned char;
uchar distab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00}; //0到f
uchar number,dat,cnt=0;
void t0isr() interrupt 1
{
TH0=(65536-10000)/256;
TL0=(65536-10000)%256;
cnt++;
if(cnt>=100)
{
cnt=0;
dat++;
dat%=24;
}
number++;
number%=2;
switch(number)
{
case 0:P2=0x02;P0=distab[dat/10];
break;
case 1:P2=0x01;P0=distab[dat%10];
break;
default:break;
}
}
main()
{
TMOD=0x61;
TH0=(65536-10000)/256;
TL0=(65536-10000)%256;
TR0=1;
ET0=1;
EA=1;
while(1);
}