#include
#include
#define uchar unsigned char
uchar keyval,led,led1;
sbit key=P3^2;
void ext0() interrupt 0
{
while(key==0);
keyval++;
keyval%=3;
}
void delay(uchar a)
{
uchar i;
while(a--)for(i=0;i<120;i++);
}
main()
{
led=0xfe;
led1=0x55;
while(1)
{
switch(keyval)
{
case 0:P1=led;led=_crol_(led,1);delay(200);break;
case 1:P1=led;led=_cror_(led,1),delay(200);break;
case 2:P1=led1;led1=~led1;delay(200);brek;
default:break;
}
}
}
27代码写错了 break