2
1
2
e
1
NOTE: Expressions are not
allowed as arguments on the BS1.
Table 5.93: SLEEP Quick Facts.
5: BASIC Stamp Command Reference – SLEEP
SLEEP
2
2
SLEEP Period
sx
p
Function
Put the BASIC Stamp into low-power mode for a specified time.
• Period is a variable/constant/expression (1 – 65535) that specifies
the duration of sleep. The unit of time for Period is 1 second, though
the BASIC Stamp rounds up to the nearest multiple of 2.3 seconds.
Quick Facts
Current draw
during run
Current draw
during SLEEP
Accuracy of
SLEEP
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.93, 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.3 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.
To ensure accuracy of SLEEP intervals, the BASIC Stamp periodically
compares the watchdog timer to the more-accurate resonator time base. It
BS1
BS2
BS2e BS2sx BS2p
BS1
BS2
2 mA
8 mA
20 µA
40 µA
±1% @ 75°F
±1% @ 75°F
with stable
with stable
power supply
power supply
BASIC Stamp Programming Manual 2.0c • www.parallaxinc.com • Page 317
BS2e
BS2sx
25 mA
60 mA
60 µA
60 µA
±1% @ 75°F
±1% @ 75°F
with stable
with stable
power supply
power supply
BS2p
40 mA
60 µA
±1% @ 75°F
with stable
power supply
Need help?
Do you have a question about the BASIC Stamp 2e and is the answer not in the manual?