单片机的P34、P35、 P36 、P37 口分别接LED1、LED2、LED3、LED4,输出低电平点亮LED灯, P32口接按键K1,按键按下时单片机输入低电平,程序如下: #include
sbit key = P3^2; unsigned char a ; unsigned char count = 15; void delay(int i) { while(i) i--; } void main() { IT0=1; EX0=1; EA =1; while(1); } void int0() interrupt 0 { count--; while(!key); if( count<0) count = 15; a = count; a = ~a; a = a<<4|0x0f; P3 = a;