- UID
- 343903
- 性别
- 男
|
程序如下,要么是进不了中断,要么就是一直在中断内循环,ACK没有将标志位清0?
interrupt void KBIIsr(void) {
KBI1SC &= ~0x02;
if (PB0==0) {
LED1 = LED_OFF;
LED2 = LED_OFF;
LED3 = LED_OFF;
LED4 = LED_OFF;
LED1=LED_ON;
gu8Command=1;
}
if (PB1==0) {
LED1 = LED_OFF;
LED2 = LED_OFF;
LED3 = LED_OFF;
LED4 = LED_OFF;
LED2=LED_ON;
gu8Command=2;
}
if (PB2==0) {
LED1 = LED_OFF;
LED2 = LED_OFF;
LED3 = LED_OFF;
LED4 = LED_OFF;
LED3=LED_ON;
gu8Command=3;
}
KBI1SC |= 0x04;
KBI1SC |= 0x02;
}
void KBIInit(void) {
KBI1SC &= ~0x02;
KBI1PE = 0xC3;
KBI1SC |= 0x04;
KBI1SC |= 0x02;
} |
|