Shop OBEX P1 Docs P2 Docs Learn Events
"waking up" a BS — Parallax Forums

"waking up" a BS

rixterrixter Posts: 95
edited 2007-02-15 06:33 in BASIC Stamp
Does anyone know how I can effectively bring a BASIC Stamp in SLEEP mode out based on the presence of activity at a sensor in the circuit? The goal here is to have the BS in the lowest battery power consumption mode until activity is present, at which time the PBASIC program runs, or in most cases, continues to run, picking up where it left off before the cessation of activity. If it were purely a goal to start a program based on activity, I could probably find a way to reset the BASIC Stamp upon activity at a sensor. But I would like to retain variables, counters, etc. that were present when the project went into power save mode. A long SLEEP command placed within a DO WHILE LOOP that monitors the state of a pin doesn't work because the duration of the SLEEP has to complete before checking the state of the DO WHILE LOOP. A short, repetitive SLEEP count within a DO WHILE LOOP defeats the purpose because the initiation of the SLEEP command itself uses battery power that I am trying to conserve. The POLLWAIT command documentation comes close to what I desire to do, but alas, I have a BS2 and that command is not available. Perhaps the statement in that command documentation that says "BASIC Stamp does not support true interrupts" may be my answer. There always seems to be someone on this forum with helpful suggestions.

Thanks.

Comments

  • Tracy AllenTracy Allen Posts: 6,662
    edited 2007-02-15 06:33
    This URL has some pointers on how to deal with event counters for short but infrequent events such as the tip of a rain gage.

    www.emesys.com/OL2rain.htm

    The idea is to "remember" the occurance of the event on a capacitor (simple dynamic memory), so the Stamp can handle it when it does wake up from SLEEP.

    Another option is a static latch or an external event counter.

    The BS2pe is better for this sort of thing, because the wake up from SLEEP is much faster and it can be put into a shorter loop or POLLWAIT without much penalty on battery life.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.