I am trying to implement an enhanced version of the interrupt code based on the experimenter board's example button debounce code. I notice in the example code the interrupt handler, Port1_ISR, uses this code for debouncing:
// Vector P1IV_P1IFG7: P1IV P1IFG.7
case P1IV_P1IFG7:
if (buttonDebounce == 1)
{
buttonDebounce = 2;
Buttons_startWDT();
__bic_SR_register_on_exit(LPM3_bits);
}
else if (buttonDebounce == 0)
{
__bic_SR_register_on_exit(LPM4_bits);
}
break;
This appears to only handle a single (simultaneous) interrupt on port 1, although this code is also repeated for the Port 2 ISR handler. I'm wondering what needs to change in order to accommodate multiple interrupts on the same port on different port pins. It seems using the same buttonDebounce variable in both the P1 and P2 (or even for multiple P1 interrupts) is problematic.
I'm not sure the WDT can be used for debouncing in a case where simultaneous P1 interrupts occur on separate pins.
Any help is greatly appreciated.
Thanks.