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.

MSP430G2553: Multiple interrupts handling on same Pin (MSP430G2553)

Part Number: MSP430G2553

Hi 

We have to write a code in MSP430G2553 so we assigned P2.3 pin as Interrupt source(i.e push button(SPST model) in Hardware).

So during 1st High/Low transition we need to make the P2.2 as high

for next High/Low transition we need to make the P2.4 as high

& next High/Low transition we need to make the P2.5 as high

& for last High/Low transition we need to make the P2.2,P2.4,P2.5 as low and this cycle repeats continuously. 

Below is the code for it but its only making only one pin high after repeated press also.

Please guide us to solve this issue.

#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=PORT2_VECTOR
__interrupt void Port_2(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(PORT2_VECTOR))) Port_2 (void)
#else
#error Compiler not supported!
#endif
{
  portCtl(&P2OUT,P22,ENABLE);
  portCtl(&P2OUT,P24,ENABLE);
  portCtl(&P2OUT,P25,ENABLE);

    P2IFG &= ~PIRINT;                           // P2.3 IFG cleared

}

  • Hi Phanendra,

    It seems that you will always run those below code if there are a interrupt. 

      portCtl(&P2OUT,P22,ENABLE);
      portCtl(&P2OUT,P24,ENABLE);
      portCtl(&P2OUT,P25,ENABLE);
    Thanks!
    Best Regards
    Johnson
  • Hi Johnson,

    Now I have used if else loop statements in ISR and its working fine,but my question is due to debounce of switch press,it sometimes skipping the states.

    But as per datasheet MSP430G2553 it has inbuilt mechanism control for avoiding debounce, but that is not happening.

    Should we use delay timer in between to control it.

    Could you please guide on this. 

  • Hi Phanendra,

    if you use the GPIO in general purpose IO mode in input function there is no device internal de-bouncing or filtering function so you either need to implement a delay inside the ISR or add external pin filtering with a cap to prevent bouncing effects.

    I think when you mention de-bounce effects you refer to pin oscillator feature right but this is not a GPIO input de-bounce feature and can only be used in secondary captivate sensing function as described in datasheet IO schematic and user guide.

**Attention** This is a public forum