Part Number: MSP432P401R
Hi,
I'm using an above-mentioned controller, here interrupt is not working. when we give the interrupt, the controller executing the default handler.
For the port1.1 how can I make interrupt to this pin. And i didn't understand this line code NVIC->ISER[1] = 1 << ((PORT1_IRQn) & 31);
Check the below code, is there any mistake?
/*************************************************
#include <msp432p401r.h>
#include <stdint.h>
void main( void )
{
P2DIR |= BIT0; //P2.0 LED
P1DIR &= ~BIT1; // P1.1 Button
P1REN |= BIT1;
P1IE = BIT1;
P1IES = BIT1;
P1IFG = ~BIT1;
P2OUT = ~BIT0;
NVIC->ISER[1] = 1 << ((PORT1_IRQn) & 31);
__enable_interrupt(); // Enable global interrupts
while( 1 ) // Endless loop - main program
{
P2OUT = BIT0;
}
}
void port1_ISR_handler( void ) // Interrupt handler for port 1
{
int i;
P2OUT = ~BIT0;
P1IE &= ~BIT1;
for(i=10000; i>0; i--);
}