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: NVIC not defined

Part Number: MSP432P401R
Other Parts Discussed in Thread: CODECOMPOSER

Tool/software: Code Composer Studio

It is my first time using interrupts with the MSP432, and I already followed every step (changing the setup file, enabling interrupts in the code, etc). When I try to build the code in CodeComposer I get an error that NVIC is not defined. I already try everything, but I do not know how to change that. If you could help me I will be very thankful.

#include <msp432p401r.h>
#include <stdint.h>


// LED1      @ P1.0
// Button S1 @ P1.1


volatile uint8_t  button_flag = 0;                         // Flag to signal button press
volatile uint32_t deb_cnt;                                 // Counter for debouncing button


void main( void )
{
  WDTCTL = (WDTPW | WDTHOLD);                              // Stop watchdog timer

  P1SEL0 = 0x00;                                           // Clear selection register 0 for port 1
  P1SEL1 = 0x00;                                           // Clear selection register 1 for port 1

  P1REN  = 0x02;                                           // Enable resistor for S1 (P1.1)
  P1OUT  = 0x02;                                           // S1 (P1.1) high -> pull-up resistor, others low
  P1DIR  = 0x01;                                           // LED1 (P1.0) to output direction, others input

  P1IES  = 0x02;                                           // Interrupt on high->low transition for S1 (P1.1)
  P1IFG  = 0x00;                                           // Clear any pending flags
  P1IE   = 0x02;                                           // Enable interrupt for S1 (P1.1)

  NVIC_ISER1 = 1 << ((INT_PORT1 - 16) & 31);               // Enable interrupts for port 1 in the NVIC module

  __enable_interrupt();                                    // Enable global interrupts

  while( 1 )                                               // Endless loop - main program
  {
    if( button_flag )
    {
      P1OUT ^= 0x01;                                       // Toggle LED1 (P1.0)
      for( deb_cnt = 0; deb_cnt < 20000; deb_cnt++ );      // Software delay for debouncing button - NOT TO USE IN A REAL PROGRAM
      button_flag = 0;                                     // Reset flag
      P1IFG &= ~0x02;                                      // Clear pending interrupt flag for S1 (P1.1)
      P1IE |= 0x02;                                        // Enable interrupt for S1 (P1.1)
    }
  }
}


void port1_ISR_handler( void )                             // Interrupt handler for port 1
{
  P1IE &= ~0x02;                                           // Disable interrupt for S1 (P1.1) for debouncing
  button_flag = 1;                                         // Set flag to signal button press detected
}

**Attention** This is a public forum