BASIC stamp manual v2.2

5: BASIC Stamp Command Reference – SLEEP
BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com Page 441
SLEEP
BS1 BS2 BS2e BS2sx BS2p BS2pe BS2px
SLEEP Duration
Function
Put the BASIC Stamp into low-power mode for a specified time.
Duration is a variable/constant/expression (1 – 65535) that specifies
the duration of sleep. The unit of time for Duration is 1 second,
though the BASIC Stamp rounds up to the nearest multiple of 2.3
seconds.
Quick Facts
Table 5.118: SLEEP Quick Facts.
NOTE: Current measurements
are based on 5-volt power, no
extra loads and 75° F ambient
temperature.
BS1 BS2 BS2e BS2sx BS2p BS2pe BS2px
Current Draw
during Run
1 mA 3 mA 25 mA 60 mA 40 mA 15 mA 55 mA
Current Draw
during SLEEP
25 µA 50 µA 200 µA 500 µA 350 µA 36 µA 450 µA
Related
Commands
END and NAP END, NAP and POLLWAIT
Accuracy of
SLEEP
±1% @ 75°F with stable power supply
Explanation
SLEEP allows the BASIC Stamp to turn itself off, then turn back on after a
programmed period of time. The length of SLEEP can range from 2.3
seconds to slightly over 18 hours. Power consumption is reduced to the
amount described in Table 5.118, assuming no loads are being driven. The
resolution of the SLEEP instruction is 2.304 seconds. SLEEP rounds the
specified number of seconds up to the nearest multiple of 2.304. For
example, SLEEP 1 causes 2.304 seconds of sleep, while SLEEP 10 causes
11.52 seconds (5 x 2.304) of sleep.
Pins retain their previous I/O directions during SLEEP. However, outputs
are interrupted every 2.3 seconds during SLEEP due to the way the chip
keeps time. The alarm clock that wakes the BASIC Stamp up is called the
watchdog timer. The watchdog is a resistor/capacitor oscillator built into
the interpreter chip. During SLEEP, the chip periodically wakes up and
adjusts a counter to determine how long it has been asleep. If it isn’t time
to wake up, the chip “hits the snooze bar” and goes back to sleep.
NOTE: Expressions are not allowed as
arguments on the BS1.
1
A
ll
2
1