#include
#define uchar unsigned char
uchar times,cnt;
uchar led[]={0x00,0xff,0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0xff};
void t0isr() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
times++;
if(times>=40)
{
times=0;
P0=led[cnt];
cnt++;
cnt%=11;
}
}
main()
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
TR0=1;
ET0=1;
EA=1;
while(1);
}
//程序很简单,你自己加注释和完成其他工作吧。