RCTIME - BASIC Stamp Command Reference
Page 256
•
BASIC Stamp Programming Manual 2.0b
•
www.parallaxinc.com
Figure 5.29 shows suitable RC circuits for use with RCTIME. The circuit in
5.29a is preferred, because the BASIC Stamp's logic threshold is
approximately 1.5 volts. This means that the voltage seen by the pin will
start at 5V then fall to 1.5V (a span of 3.5V) before RCTIME stops. With
the circuit of 5.29b, the voltage will start at 0V and rise to 1.5V (spanning
only 1.5V) before RCTIME stops. For the same combination of R and C,
the circuit shown in 5.29a will yield a higher count, and therefore more
resolution than 5.29b.
Before RCTIME executes, the capacitor must be put into the state specified
in the RCTIME instruction. For example, with figure 5.29a, the capacitor
must be discharged until both plates (sides of the capacitor) are at 5V. It
may seem counterintuitive that discharging the capacitor makes the input
high, but remember that a capacitor is charged when there is a voltage
difference between its plates. When both sides are at +5V, the cap is
considered discharged.
Here’s a typical sequence of instructions for 5.29a (assuming I/O pin 7 is
used):
Result VAR WORD ' Word variable to hold result.
HIGH 7 ' Discharge the cap
PAUSE 1 ' for 1 ms.
RCTIME 7,1,Result ' Measure RC charge time.
DEBUG ? Result ' Show value on screen.
Using RCTIME is very straightforward, except for one detail: For a given R
and C, what value will RCTIME return? It’s easy to figure, based on a
a
b
R
C
use with state = 0
use with state = 1 (preferred - see text)
Vdd
Vss
to I/O pin
220
Ω
R
C
Vdd
Vss
to I/O pin
220
Ω
Figure 5.29: Example RC Circuits.
Use A (left) with State = 1. Use B
(right) with State = 0.
S
UITABLE
RCT
IME CIRCUITS
.
P
REDICTING THE RETURNED VALUE
.
D
ON
'
T FORGET TO DISCHARGE THE
CAPACITOR BEFORE EXECUTING
RCTIME.
Содержание BASIC Stamp 1
Страница 1: ...BASIC Stamp Programming Manual Version 2 0c...
Страница 30: ...Introduction to the BASIC Stamps Page 28 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 90: ...BUTTON BASIC Stamp Command Reference Page 88 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 118: ...END BASIC Stamp Command Reference Page 116 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 128: ...FREQOUT BASIC Stamp Command Reference Page 126 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 196: ...NAP BASIC Stamp Command Reference Page 194 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 206: ...OWIN BASIC Stamp Command Reference Page 204 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 214: ...OWOUT BASIC Stamp Command Reference Page 212 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 216: ...PAUSE BASIC Stamp Command Reference Page 214 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 226: ...POLLMODE BASIC Stamp Command Reference Page 224 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 232: ...POLLOUT BASIC Stamp Command Reference Page 230 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 236: ...POLLRUN BASIC Stamp Command Reference Page 234 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 240: ...POLLWAIT BASIC Stamp Command Reference Page 238 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 262: ...RCTIME BASIC Stamp Command Reference Page 260 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 274: ...RUN BASIC Stamp Command Reference Page 272 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 310: ...SEROUT BASIC Stamp Command Reference Page 308 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 324: ...STOP BASIC Stamp Command Reference Page 322 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...