I have a problem with this code. I think it is configured right to enter the interrupt when I press the button on the msp430fr2433 launch pad
I did some debugging and the IFG flag does trigger when I press the button and the transition from hi to low occurs. but for some reason is not entering the pragma vector interrupt.
When I pause the program it is stuck on the ISR Trap code.
Any ideas?
#include <msp430fr2433.h>
int main(void)
{
PM5CTL0 &= ~LOCKLPM5;
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
//sClock Enable Registers
__bis_SR_register(SCG0); // disable FLL
CSCTL3 |= SELREF__REFOCLK; // Set REFO as FLL reference source
CSCTL0 = 0; // clear DCO and MOD registers
CSCTL1 &= ~(DCORSEL_7); // Clear DCO frequency select bits first
CSCTL1 |= DCORSEL_3; // Set DCO = 8MHz
CSCTL2 = FLLD_0 + 243; // DCODIV = 8MHz
__delay_cycles(3);
__bic_SR_register(SCG0); // enable FLL
while(CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1)); // Poll until FLL is locked
CSCTL4 = SELMS__DCOCLKDIV | SELA__REFOCLK; // set default REFO(~32768Hz) as ACLK source, ACLK = 32768Hz
//default DCODIV as MCLK and SMCLK source
//End of clock Configuration
//Timer Config
// TA0CTL=TASSEL__SMCLK | MC__CONTINUOUS | TACLR;
// Timer starts counting
// __delay_cycles(20);
//Configure LED Oouput
P1DIR |= BIT0; // On board LED P1.0
P1DIR |= BIT1; // On Board LED P1.1 Red is actually GREEN
P1OUT &=~BIT1; //Clear LED 1
P1OUT &=~BIT0; //Clear LED 0
//Configure Buttons as Input
P2DIR &=~ BIT3; // Set pin 2.3 as input
P2REN |= BIT3; // Enable pullup/down resistor
P2OUT |= BIT3; // Set Resistor as Pull Up
//Configure Button as Input with Interrupt
P2DIR &=~ BIT7; // Set pin 2.7 as input
P2REN |= BIT7; // Enable pullup/down resistor
P2OUT |= BIT7; // Set Resistor as Pull Up
P2IES |= BIT7; // P2.7 Hi/Low edge
P2IFG &= ~BIT7; // P2.7 IFG cleared
P2IE |= BIT7; // P2.7 interrupt enabled
while(1)
{
__bis_SR_register(LPM3_bits | GIE); // Enter LPM3 w/interrupt
__no_operation(); // For debug
}
}
// Port 2 interrupt service routine
#pragma vector=PORT2_VECTOR
__interrupt void Port_2(void)
{
P2IFG &= ~BIT7; // Clear P2.7 IFG
P1OUT ^=BIT1; //Set LED 1
__bic_SR_register_on_exit(LPM3_bits);
}