Hi. I am trying tot write a simple code that will turn on an LED when I push a button but something is wrong with my code and I can't figure it out.
I am using the msp430fr4133 LaunchPad.
Can you tell me where I did wrong?
Thank you.
Here is the code:
//interrupt with push button
#include <msp430.h>
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1DIR |= BIT0; // Set P1.0 to output direction
P1OUT &= ~BIT0; // set P1.0 to 0 (LED OFF)
P1IES = 0x00; //low to high transition
P1IE |= BIT2; // P1.2 interrupt enabled
P1IFG &= ~BIT2; // P1.2 IFG cleared
PM5CTL0 &= ~LOCKLPM5;
__bis_SR_register(LPM0_bits | GIE); // Enter LPM0 w/ interrupt
__no_operation();
}
// Port 1 interrupt service routine
#pragma vector = PORT1_VECTOR
__interrupt void PORT1_ISR(void)
{
P1OUT |= BIT0; // led on
}