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.

MSP432P401R: Setting 2 GPIO interrupts on on same port?

Part Number: MSP432P401R


Hello

The MSP432P401R LaunchPad™ Development Kit (MSP‑EXP432P401R) has 2 switches; S1 and S2 connected to same port but different pins; S1 is connected to P1.1 and S2 is connected to P1.4

My question is, How to setup 2 interrupts with 2 different ISRs on port1, so for example when S1 is pressed ISR1 gets executed, and when S2 is pressed ISR2 gets executed?

Thanks in advance   

  • You can't. They're both connected to the same vector (PORT1_IRQHandler) which will be called for either (or both).

    You can distinguish in the ISR by checking P1->IFG (and/or P1->IN, depending on your application). Something like:

    void PORT1_IRQHandler(void)
    {
        if (P1->IFG & BIT1) {   // S1 (P1.1) triggered?
           // S1 stuff
           P1->IFG &= ~BIT1;
        }
        if (P1->IFG & BIT4) {   // S2 (P1.4) triggered?
           // S2 stuff
           P1->IFG &= ~BIT4;
        }
        return;
    }
    

  • Thanks a lot 

    That actually works!

    I have a minor question, now I am learning from prof Valvano's lecture on TI website and of course looking at MSP432 data sheet, Launchpad user's guide, what I really lacking here is a programming guide

    To be more clear, that is the first time to know that I can point to some pin on port1 clear flag register using P1->IFG (I used to the driverlib, e.g. GPIO_clearInterruptFlag (GPIO_PORT_P1, GPIO_PIN4);)

    so what is the available programming guide for MSP432?

    Thanks in advance

  • You mentioned the data sheet (SLAS826G), which describes the particulars of the device (P401R). A fuller/more general description, covering more of the "P" series, is the Technical Reference Manual (SLAU356I), which describes what register bits do what.

**Attention** This is a public forum