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.

CCS/MSP432P401R: Verify toggle on P2.3 with interruption

Part Number: MSP432P401R

Tool/software: Code Composer Studio

Hello fellows,

I am trying to verify when the pin P2->IN change is state, but I have try everything and I don't get anything with success. So my intention is each time the P2.3 goes from low to High and High to low an interrupt occurs, and the blue led blink, anyone can help me?

#include <msp432p401r.h>
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
void WatchDogHold(void);
/*
| Name |  Hex | Binary     || Name |  Hex | Binary     |
|------+------+------------++------+------+------------|
| BIT0 | 0x01 | 0000 0001b || BIT4 | 0x10 | 0001 0000b |
| BIT1 | 0x02 | 0000 0010b || BIT5 | 0x20 | 0010 0000b |
| BIT2 | 0x04 | 0000 0100b || BIT6 | 0x40 | 0100 0000b |
| BIT3 | 0x08 | 0000 1000b || BIT7 | 0x80 | 1000 0000b |
 */
     void main(void) {

    WatchDogHold();
    P2->DIR |= BIT0 | BIT1 | BIT2;              //OUTPUT DIR PIN 0,1,2,3 PORT2
    P2->OUT &= ~(BIT0 | BIT1);                  // RELEASE (DESACTIVATE)  OUTPUT DIR PIN 0,1,2,3

    P2->DIR  &= ~(BIT3);

    P2->OUT  |= BIT4;
    P2->REN  |= BIT4;

    P2->IES  |= BIT3;                            //HIGH TO LOW EDGE
    P2->IFG  &= ~(BIT3);                         // CLEAR INTERRUP FLAG
    P2->IE   |= BIT3;                            //INTERRUPT ON INPUT PIN 3

    /*ENABLE GLOBAL INTERRUPT*/
    __enable_interrupt();
    /*ENABLE PORT2 INTERRUPT IN NVIC MODULE*/
    NVIC->ISER[1] = 1 << ((PORT2_IRQn) & 31);
    while(1){

    }
}
    void PORT2_IRQHandler(void){

       volatile uint32_t i;
       printf("TEST %s\n","OK");
       if(P2->IFG & BIT3){
           P2->OUT ^= BIT2; // TOOGLE BLUE LED
           
           P2->IES ^= BIT3; //TOOGLE EDGE SENSIVITY
           P2->IFG  &= ~(BIT3); //CLEAR INTERRUPT FLAG
          
           for (i = 200; i > 0; i--);

       }

}

void WatchDogHold(void){
        WDTCTL = WDTPW | WDTHOLD;                       /*STOP WATCHDOG TIMER*/
}

**Attention** This is a public forum