#include
#define uchar unsigned char
sbit key1=P1^0;
sbit key2=P1^1;
sbit key3=P1^2;
sbit key4=P1^3;
sbit led1=P1^4;
sbit led2=P1^5;
main()
{
if(key1==0)
{
while(key1==0);
led1=0;
led2=1;
}
if(key2==0)
{
while(key2==0);
led1=1;
led2=0;
}
if(key3==0)
{
while(key3==0);
led1=0;
led2=0;
}
if(key4==0)
{
while(key4==0);
led1=1;
led2=1;
}
}
简单