Are SX register values lost after sleeping and wake-up?
![william chan](https://forums.parallax.com/uploads/userpics/RBTCEMRWP85K/nQFR9OII9OM33.jpg)
Let's say we assign some values to a few registers in bank 7.
Then we make the SX go to sleep to save power.
When the SX wakes up, will the values in the registers be lost?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
Then we make the SX go to sleep to save power.
When the SX wakes up, will the values in the registers be lost?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
Comments
When the SX wakes up it starts executing code from the beginning again. It does NOT continue with the next command after the SLEEP command.
Read this application note: http://www.parallax.com/dl/appnt/sx/An18Reset.pdf
Also if you are using SX/B make sure you specify NOSTARTUP on the PROGRAM line or else the compiler WILL clear all variables after you wake-up from sleep.
Then you can just use:
· IF PD = 1 THEN ' Check "Power Down" flag
··· ' Power Up Code
· ELSE
··· ' Wake-up Code here
· ENDIF
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My goal is to live forever...Or die trying.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
Post Edited (Bean (Hitt Consulting)) : 10/6/2007 2:58:17 PM GMT
I agree with Jonny Mac, this is too easy to test by yourself.
However, now that I'm on-line, I will answer that the RAM memory remains unaffected on wake-from-sleep.
Cheers,
Peter (pjv)