单片机的P34、P35、 P36 、P37 口分别接LED1、LED2、LED3、LED4,输出低电平点亮LED灯, P32口接按键K1,按键按下时单片机输入低电平,程序如下: #include "reg52.h" sbit P32=P3^2; void main() { IT0=1; EX0=1; EA=1; while(1); } void int0() interrupt 0 { static unsigned char Bit=0; Bit++; if(Bit>=4)Bit =0; switch(Bit) { case 0: P3 = 0xef; break; case 1: P3 = 0xdf; break; case 2: P3 = 0xbf; break; case 3: P3 = 0x7f; break; } }