I am trying to run the TI ADC12 example on my MSP430F5529 that samples A0 Input and turns LED P1.0 on if A0 > 0.5*AVcc.
I am having this strange issue where the program only works while running in debug mode, when i power the board with via usb but not in debug mode the LED doesn't respond to the input. My input is from a force sensor and it works perfectly in debug mode.
I started this thread on stack exchange and narrowed down the issue: It seems that there are two solutions to my problem, i can either put a delay inside the ISR using __delay_cylces, or i can change the line
__bic_SR_register_on_exit(LPM0_bits);
to be
__bic_SR_register_on_exit(LPM0_bits + GIE);
My question is, why does the delay inside the ISR cause the program to work properly? And what does __bic_SR_register_on_exit do exactly? Why does the example not have the GIE bit set when it calls it?