Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 62309

Forum Post: Pushbutton interrupt code MSP430FR4133

$
0
0
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 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 }

Viewing all articles
Browse latest Browse all 62309

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>