5: BASIC Stamp Command Reference – POT
BASIC Stamp Programming Manual 2.0c
•
www.parallaxinc.com
•
Page 239
POT
BS1
BS2 BS2e BS2sx BS2p
POT
Pin, Scale, Variable
(See RCTIME)
Function
Read a 5 k
Ω
to 50 k
Ω
potentiometer, thermistor, photocell, or other
variable resistance.
•
Pin
is a variable/constant (0 – 7) that specifies the I/O pin to use.
This pin will be set to output mode initially, then to input mode.
•
Scale
is a variable/constant (0 – 255) used to scale the command's
internal 16-bit result. See Explanation below for steps to finding the
scale value to use for your circuit.
•
Variable
is a variable (usually a byte) where the final result of the
reading will be stored. Internally, the POT command calculates a
16-bit value, which is scaled down to an 8-bit value.
Explanation
POT reads a variable resistance and returns a value (0 – 255) representing
the amount of time it took to discharge the capacitor through the
resistance. Pin must be connected to one side of the variable resistance,
whose other side is connected through a capacitor to ground, as shown in
Figure 5.25.
POT works by first setting the specified I/O pin to an output and setting
its state high. This step 5 volts on one side of the capacitor (see
Figure 5.25) and ground (0 volts) on the other side, which charges the
capacitor. POT waits for 10 ms and then sets the I/O pin to an input mode
and starts its timer. Initially the I/O pin will see a high (1) that will
eventually drop to a low (0) when the capacitor discharges past the 1.4-
volt threshold. The timer stops once the low is seen. The value of the
1
2
e
2
sx
2
p
2
P0
5 k
Ω
to 50
k
Ω
variable resistance
Vss
0.1 uF
Figure 5.25: Example Variable
Resistance Circuit.
H
OW
POT
REALLY WORKS
.
Содержание 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...