I've got a problem with my MSP430F437.
Given a simple while loop:
_BIS_SR(LPM3_bits); // enter LPM3 mode
Inside a port ISR, I set the variable "var" to 1, if a button is pressed:
interrupt (PORT2_VECTOR) port2_handler()
var = 1;
_BIC_SR_IRQ(LPM3_bits); // Exit LPM3 on ISR exit
So in my opininon, the while loop should be left if a button is pressed, because "var" doesn't have any longer the value 0. Unfortunately, this doesn't happen! When I debug the program step-by-step, the program execution always stays in the while loop after exiting the port ISR, and the MSP falls into LPM3 again.
Has anybody an idea why this doesn't work correctly? Thanks in advance!
var would have to declared as volatile for your code to work.
volatile int var;
Thanks a lot, Peter! Now my code does exactly what it is supposed to do.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.