#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
uchar t,temp,flag;
sbit key1=P3^4;
sbit key2=P3^5;
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void init()
{
TMOD=0x10;
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
EA=1;
ET1=1;
TR1=1;
temp=0xfe;
}
void main()
{
init();
while(1)
{
P1=temp;
if(key1==0)
{
temp=0x55;
while(!key1)
{
t=0;
P1=temp;
}
}
if(key2==0)
{
temp=0;
while(!key2)
{
t=0;
P1=temp;
flag=1;
}
}
}
}
void timer1() interrupt 3
{
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
t++;
if(t==10)
{
t=0;
temp=_crol_(temp,1);
if(flag==1)
{
temp=0xff;
flag=0;
}
}
}