#include
#include
#define uchar unsigned char
sbit key=P1^0;
uchar led,time;
void t0isr() interrupt 1
{
TH0=(65536-60000)/256;
TL0=(65536-60000)%256;
switch(time)
{
case 0:P0=led;led=_crol_(led,1);break;
case 1:P0=led;led=_cror_(led,1);brea;
case 2:P0=led;led=~led;break;
}
}
main()
{
TMOD=0x01;
TH0=(65536-60000)/256;
TL0=(65536-60000)%256;
TR0=1;
ET0=1;
EA=1;
led=0xfe;
while(1)
{
if(key==0)
{
while(key==0);
time++;
time%=3;
if(time==0)led=0xfe;
else if(time==1)led=0x7f;
else led=0x55;
}
}
}