#include
#define uchar unsigned char
#define uint unsigned int
uchar code table[10] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
uint count=0;
void time0_int(void)
{
TMOD=0x00;//工作方式0
TH0=0xe3;//高八位赋值,使之延时为1ms
TL0=0x06;//低八位赋值
ET0=1;//T0开中断
EA=1;//开总中断
TR0=1;//启动定时器
}
void time0() interrupt 1
{
TH0=0xe3;//高八位赋值
TL0=0x06;//低八位赋值
count++;
}
void main(void)
{
uchar i=0;
void time0_int();
P2=0xfe;
while(1)
{
P0=table[i%10];
if(count==1000)
{
count=0;
i++;
}
}
}