#include
#include
#define uchar unsigned char
sbit key1=P1^0;
sbit key2=P1^1;
sbit key3=P1^2;
sbit key4=P1^3;
uchar led=0xfe,led1=0x00;
void delay(uchar a)
{
uchar i;
while(a--)for(i=0;i<120;i++);
}
main()
uchar keyval=0;
{
while(1)
{
if(key1==0);
{
while(key1==0);
keyval=1;
}
if(key2=0);
{
while(key2==0);
keyval=2;
}
if(key3==0);
{
while(key3==0);
keyval=3;
}
if(key4==0);
{
while(key4==0);
keyval=4;
}
switch(keyval)
{
case 1:
P0=led1;
led1=~led1;
delay(100);
break;
case 2:
P0=0xff;
break;
case 3:
P0=led;
led=_crol_(led,1);
delay(100);
break;
case 4:
P0=led;
led=_cror_(led,1);
delay(100);
break;
}
}
}