Jump to content
43oh

testhack

Members
  • Content Count

    2
  • Joined

  • Last visited

Reputation Activity

  1. Like
    testhack reacted to greeeg in Interrupt Debounce   
    Regardless of the value in the InterruptEnable (PxIE) register the InterruptFlag (PxIFG) register will be set when an edge transition matching the value in InterruptEdgeSelect (PxIES) register.
     
    If that bit is set when you re-enable the interrupt wont that trigger another P1 interrupt? To remove this occurrence you just need to re-clear the flag once the WDT timeout has occurred.  That being said, you may still see an interrupt occur on switch release.
    // WDT Interrupt Service Routine used to de-bounce button press #pragma vector=WDT_VECTOR __interrupt void WDT_ISR(void) { IE1 &= ~WDTIE; // disable Watchdog timer (WDT) interrupt IFG1 &= ~WDTIFG; // clear WDT interrupt flag WDTCTL = WDTPW + WDTHOLD; // put WDT back in hold state P1IFG &= ~BUTTON; // clear pending interupt P1IE |= BUTTON; // Reenable interrupts for the button }
×
×
  • Create New...