This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR58471: Preventing additional interrupts

Part Number: MSP430FR58471


I'm using MSP430FR59471IRHAT device. There is an interrupt defined on P2.2 input (the interrupt is produced on signal falling  edge). When there are more than one consecutive pulses at P2.2, microcontroller produces series of multiple interrupts. I want microcontroller to produce an interrupt only for the first event. How can I prevent producing interrupts for all following input changes?

I've already tried to disable interrupts by clearing bit 2 in P2IFG register. It does not help.

Here is the relevant ISR code:


//Configuration of P2.2 input:

 P2DIR &= ~BIT2; // Set P2.2 to input direction

 P2IES |= BIT2; //interrupt flag is set on the falling edge of P2.2

 P2IFG &= ~BIT2; //clear interrupt flag on P2.2

 P2IE |= BIT2;   //enable interrupt on P2.2



//          Port2 interrupt service routine


#pragma vector = PORT2_VECTOR

__interrupt void PORT2_ISR (void)


               //P2IE &= ~BIT2;   //disable additional interrupts from P2.2 (does not disable further interrupts)






             P4OUT |= BIT1;    //1 => set SW5_CMD  to 'ON' state

             P2IFG = 0; // clear all interrupt flags in P2IFG register

          //P2IE |= BIT2;           //re-enable additional interrupts from P2.2

} //end of the Port 2 interrupt routine

  • Why did you comment out the "P2IE &= ~BIT2;" line?
  • Hey Lavi,

    When posting code, please use the </> code insertion button to keep it's formatting and readability to get the best feedback from the community. I've edited you post to use the tool.

    As for your issue, it sounds like you're seeing bouncing on you input. It this from a switch/button or something else? I'm guessing that you want to pick up each button press only once, and are trying to avoid the bouncing signal at the boundries.

    There are multiple discussions of debouncing signals on this forum, and this post has a good discussion.

    This site also has a great detailed discussion and solutions to this topic:

    The most robust solution is to setup a timer interupt, maybe every 10 or 30 ms, and just poll the input pin there. If the state changes and remains changed for x # of counts, then the event has taken place.

    Best Regards,

**Attention** This is a public forum