#include
#include "intrins.h"
#include "absacc.h"
#define uchar unsigned char
uchar ledtab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x40,0xff};//0-9
uchar num,cnt;
bit flag=0;
void ext1() interrupt 2
{
flag=~flag;
}
void t1isr() interrupt 3 //显示
{
TH1=0xec;
TL1=0x78;
P0=0xff;
P2=0xfe;
P0=ledtab[num];
cnt++;
if(cnt>=200)
{
cnt=0;
if(flag==0)num++;
num%=10;
}
}
main()
{
TMOD=0x10;
TH1=0xec;
TL1=0x78;
TR1=1;
ET1=1;
EX1=1;
IT1=1;
EA=1;
while(1);
}