Hello Steve, >The syntax you need is like this. If the main code does this: >_BIS_SR(LPM3_bits); >you will go into LPM3 mode. >[...] >you will come back out of LPM3 mode. It works for the other low power modes too, by just changing "3".
It's not that simple in all cases. Suppose you're in LPM3 mode and want to go to LPM2 mode, you cannot just do _BIS_SR(LPM2_bits), because: LPM3_bits is defined as SCG1+SCG0+CPUOFF LPM2_bits is defined as SCG1+CPUOFF so in this case _BIS_SR(LPM2_bits) will have absolutely no effect, and you stay in LPM3. What is needed in this case is either _BIC_SR(SCG0) which is the same as _BIC_SR(LPM3_bits^LPM2_bits), or a two instruction sequence: _BIC_SR(LPM3_bits); _BIS_SR(LPM2_bits). This doesn't matter if you're only switching between operational mode and _one_ of the low-power modes, and are not mixing different low power modes in the same program. greetings, Tom
