irenedonati 0 Posted May 20, 2014 Share Posted May 20, 2014 Hi everyone, it is probably a very stupid question. But i'm simply trying to toggle a LED(P1.0) by using the button S2(P1.1) which is on the launch pad of FR5969. but it is not wotking at all... #include <msp430.h> void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR |= 0x01; // Set P1.0 to output direction P1REN = 0x02; ? P1OUT= 0x02; ? P1IE |= 0x02; // P1.1 interrupt enabled P1IES |= 0x02; // P1.1 Hi/lo edge P1IFG &= ~0x02; // P1.1 IFG cleared _BIS_SR(LPM3_bits + GIE); // Enter LPM4 w/interrupt } // Port 1 interrupt service routine #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { P1OUT ^= 0x01; // P1.0 = toggle P1IFG &= ~0x02; // P1.4 IFG cleared } any suggestions? Thanks in advance Irene Quote Link to post Share on other sites
roadrunner84 466 Posted May 21, 2014 Share Posted May 21, 2014 It looks fine to me. Just one thing, you enter LPM3 by setting bits LPM3_bits + GIE. Are you sure GIE is not already in LPM3_bits? If it is, you do not get the intended behaviour, when fiddling with bits I prefer using OR over ADD: LPM3_bits | GIE Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.