Shop OBEX P1 Docs P2 Docs Learn Events
Are SX register values lost after sleeping and wake-up? — Parallax Forums

Are SX register values lost after sleeping and wake-up?

william chanwilliam chan Posts: 1,326
edited 2007-10-06 17:24 in General Discussion
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

Comments

  • JonnyMacJonnyMac Posts: 9,216
    edited 2007-10-06 13:47
    Couldn't you just write a simple test program to verify that? Or check the docs?...
  • BeanBean Posts: 8,129
    edited 2007-10-06 14:23
    william,

    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
  • pjvpjv Posts: 1,903
    edited 2007-10-06 17:24
    Hi William;

    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)
Sign In or Register to comment.