Hi,
I have a nA timer that is generating interrupt outputs. The output is connected to Port 1.1 and Port 1.2. I want the MSP 430 to turn off and enter it's lowest power state and then wake up on an interrupt from the timer. I have proven that the timer is generating interrupts by having a simple LED flash every time there is an interrupt. Now I am trying to enter LPM0 and wake up the device using the same interrupt. This does not work. Could you please help me with understanding what I have done wrong, the code is below.
In the code, you can see the LPM0 code that i have commented out. With this code commented out, the code functions as I expect, with the code executable, the processor stops and remains stopped on the BIS line. It seems like the interrupt is not detected. Do I need to set Port 1 into a different power mode when I am in LPM0 or something like that? The same behavior occurs in all LPM modes not just LPM0.
FYI Port 1 is set as all inputs, all interrupt flags enabled.
Thank you in advance
Richard
while(1)
{
Data_Register=0x06; //;
register_data=read_a_byte(); //Communicate with i2C device and read a byte
if(port_1_interrupt==1) //If there is an interrupt simply flash an LED
{
P6OUT |= 0b1000000;
_delay_cycles(1000000);
P6OUT &=0b0000000;
_delay_cycles(1000000);
P6OUT |= 0b1000000;
_delay_cycles(1000000);
P6OUT &=0b0000000;
_delay_cycles(1000000);
port_1_interrupt=0;
}
_delay_cycles(100000); //Wait to slow down communication loop
//__bis_SR_register(LPM0_bits + GIE); <- if I uncomment this line, the code never sees an interrupt and does not wake up
//__no_operation();
}
///////////////////////////////// Port 1 interrupt service routine//////////////////////////////////////////
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
//port2_interrupt_pending=1;
P1IFG &=~0b111111110; // Clear all the interrupt flags
port_1_interrupt=1; //Set a global flag
__bic_SR_register_on_exit(LPM0_bits);// Exit from LPM to make CPU active
__bis_SR_register(GIE); //Enable Global Interrupts
}