Shop OBEX P1 Docs P2 Docs Learn Events
When power is interupted, does the STAMP start where it left off or back at the — Parallax Forums

When power is interupted, does the STAMP start where it left off or back at the

JedJed Posts: 107
edited 2008-02-14 04:30 in BASIC Stamp
If power is turned off on the STAMP, does it resume where it left off when it's turned back on? And if so, is there a way to get it to either start completely over or go to a specific startup routine?

Comments

  • UghaUgha Posts: 543
    edited 2008-02-14 02:10
    When power is cut, it resets the program.

    But I guess its possible to write to a section of EEPROM at various "stages" in your program, then
    read them each time the stamp is reset.

    Remember though, that EEPROM isn't really meant to store data like this, it's meant to store programs...
    so it'll cut into your 1 million or so write cycles... so it'd be best not to store too much, too often in there.

    Look into the WRITE and READ commands... its all in the Pbasic helpfile.
  • JedJed Posts: 107
    edited 2008-02-14 03:46
    Yes, that's what I figured you could do if you wanted it to "resume" where it left off, but I've noticed a couple of times I turn the stamp on and it seems to start in the middle of a program.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-02-14 04:30
    Jed -

    It takes a good bit of forethought and planning to have a PBASIC Stamp "resume" from anywhere other than the beginning of the program on restart. You make it sound like a rather simple task.

    If you have a program which seems to restart at other than the beginning, it may be caused by one of two things usually. First, it may simply be a programming error. Second, you may have a short or overload in your wiring causing the Stamp to go into brown-out mode. Once reset occurs due to a brown-out it will appear as though part of the program has executed, and then it kind of drops dead.

    You can tell if a restart has occured by adding the following line to the beginning of your program:

    DEBUG "Starting". If that appears more than once during any iteration of the program, you can be pretty well assured a brown-out or some other cause of reset has occured.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Genius is one percent inspiration and ninety-nine percent perspiration."

    Thomas Alva Edison
Sign In or Register to comment.