Specifications

BASIC Stamp II
Parallax, Inc. • BASIC Stamp Programming Manual 1.8 • Page 285
2
Nap
NAP
period
Enter sleep mode for a short period. Power consumption is reduced to
about 50 µA assuming no loads are being driven.
Period
is a variable/constant that determines the duration of the
reduced power nap. The duration is (2^period) * 18 ms. (Read
that as “2 raised to the power period, times 18 ms.”) Period can
range from 0 to 7, resulting in the following nap lengths:
Period 2
period
Length of Nap
0118.ms
1236.ms
2472.ms
3 8 144.ms
4 16 288.ms
5 32 576.ms
6 64 1152.ms (1.152 seconds)
7 128 2304.ms (2.304 seconds)
Explanation
Nap uses the same shutdown/startup mechanism as Sleep, with one
big difference. During Sleep, the BS2 automatically compensates for
variations in the speed of the watchdog timer oscillator that serves as
its alarm clock. As a result, longer Sleep intervals are accurate to ap-
proximately ±1 percent. Nap intervals are directly controlled by the
watchdog timer without compensation. Variations in temperature, sup-
ply voltage, and manufacturing tolerance of the BS2 interpreter chip
can cause the actual timing to vary by as much as –50, +100 percent
(i.e., a period-0 Nap can range from 9 to 36 ms). At room temperature
with a fresh battery or other stable power supply, variations in the length
of a Nap will be less than ±10 percent.
If your application is driving loads (sourcing or sinking current through
output-high or output-low pins) during a Nap, current will be inter-
rupted for about 18ms when the BS2 wakes up. The r eason is that the
watchdog-timer reset that awakens the BS2 also causes all of the pins
to switch to input mode for approximately 18 ms. When the PBASIC2
interpreter firmware regains control of the processor, it restores the