Hi
I bought a MSP430f5529LP launchpad and tried to test onboard components by writing a simple code to read push button on P2.1 as interrupt but it does not seem to work.
Is there any other register I need to enable or any other intrinsic function to be used to enable interrupt?
#include <msp430.h>
#define DELAY() \
i = 10000; \
do i--; \
while(i != 0)
/*
* main.c
*/
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
P1DIR |= BIT0;
P4DIR |= BIT7;
P2DIR &= ~BIT1;
P2REN |= BIT1;
P2OUT |= BIT1;
P2IE |= BIT1;
P2IFG &= ~BIT1;
__enable_interrupt(); //Enable all interrupts.
//_BIS_SR(LPM4_bits + GIE); // Enter LPM4 w/interrupt
while(1)
{
unsigned volatile long i;
P1OUT ^= BIT0; //toggle P1.0
DELAY();
}
}
#pragma vector = PORT1_VECTOR
__interrupt void port_1(void)
{
P4OUT |= BIT7; //Glow P4.7 on interrupt.
P2IFG &= ~BIT1;
}
Now in the above code when push button on P2.1 is pressed the LED on P4.7 should glow, but it does not.
Kindly advise.