Tool/software: Code Composer Studio
Hi,
I am trying to toggle an LED on the MSP430F5529 Launchpad when a button is pressed. The button is on board the chip, connected to P1.1, and the LED is connected to 1.0.
I am not getting an interrupt for the button press.
My code is shown below. Can you tell me what is wrong?
#include <msp430.h> /** * main.c */ int main(void) { WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer //Switch LED off P1DIR |= BIT0; // P1.0 is output and the rest are input P1OUT &= ~0x01; P1IE |= (BIT1); P1IES &= (~BIT1); // Falling Edge 1 -> 0 P1IFG &= (~BIT1); // Clear interrupt flag for P2.1 while (1) { __bis_SR_register(LPM0_bits + GIE); // Enter LPM0 and wait for an interrupt __no_operation(); // Set breakpoint >>here<< and read } return 0; } #pragma vector = PORT1_VECTOR __interrupt void InterruptVectorPort1() { P1OUT ^= 0x01; // Toggle P1.0 P1IFG &= ~BIT1; // Clear Interrupt Flag }