Part Number: MSP430FR2311
Tool/software: Code Composer Studio
I'm trying to get the launchpad to go into LPM3 unless it receives a high signal (3.3V) from pin 2.6 ( I have an LED turning on so that I can see it on the launchpad) which is a GPIO interrupt pin.
I have pin 2.6 connected to the ON signal from a xbee module. Not sure if I am setting up my interrupt vector correctly.Thanks in advance.
#include <msp430.h>
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
// Disable the GPIO power-on default high-impedance mode
// to activate previously configured port settings
PM5CTL0 &= ~LOCKLPM5;
P1DIR |= BIT1; // Set P1.0 to output direction
P2DIR &= ~BIT6;
P2REN &= ~BIT6;
P2IES &= ~BIT6; // P2.6 Lo/High edge
P2IE |= BIT6;
P2IFG &= ~BIT6;
__bis_SR_register(GIE); // Global interrupts Enable
}
// Port 2 interrupt service routine
#pragma vector=PORT2_VECTOR
__interrupt void Port2_ISR(void)
{
P2IFG &= ~BIT6; // Clear P2.6 IFG
P1OUT |= BIT0; // led ON
__bic_SR_register_on_exit(LPM3_bits); // Exit LPM3
}