缘由ISIS 7 Professional_有问必答-CSDN问答
cpp
#include "REG52.h"
sbit K1 = P3^0;
sbit K2 = P3^1;
sbit K3 = P3^2;
sbit K4 = P3^3;
void main()
{
unsigned char Xd=0,xz=0,cs=0;
unsigned int wei=0;P1=255;
while(1)
{
if(K1==0&&++Xd==0){P1=0;while(K1==0);}
if(K2==0&&++Xd==0){P1=85;while(K2==0);}
if(K3==0&&++Xd==0){P1=15;while(K3==0);}
if(K4==0&&++Xd==0){P1=240;while(K4==0);}
}
}