POT - BASIC Stamp Command Reference
Page 240
•
BASIC Stamp Programming Manual 2.0b
•
www.parallaxinc.com
variable resistor affects the time it takes to discharge the capacitor from 5
volts to approximately 1.4 volts.
The 16-bit reading is multiplied by (Scale/256), so a scale value of 128
would reduce the range by approximately 50%, a scale of 64 would reduce
to 25%, and so on. The amount by which the internal value must be scaled
varies with the size of the resistor being used.
Finding the best Scale value:
1. Build the circuit shown in Figure 5.25 and plug the BS1 into the
PC.
2. In the DOS editor (stamp.exe) press ALT-P. A special calibration
window appears, allowing you to find the best value.
3. The window asks for the number of the I/O pin to which the
variable resistor is connected. Select the appropriate pin (0-7).
4. The editor downloads a short program to the BS1 (this overwrites
any program already stored in the BS1).
5. Another window appears, showing two numbers: scale and value.
Adjust the resistor until the smallest number is shown for scale
(assuming you can adjust the resistor, as with a potentiometer).
6. Once you’ve found the smallest number for scale, you’re done.
This number should be used for the Scale in the POT command.
7. Optionally, you can verify the scale number found above by
pressing the spacebar. This locks the scale and causes the BS1 to
read the resistor continuously. The window displays the value. If
the scale is good, you should be able to adjust the resistor,
achieving a 0–255 reading for the value (or as close as possible). To
change the scale value and repeat this step, just press the spacebar.
Continue this process until you find the best scale.
Demo Program (POT.bas)
' This program demonstrates the PAUSE command's time delays. Once a second, the
' program will put the message, "paused" on the screen.
'{$STAMP BS1} 'STAMP directive (specifies a BS1)
Loop:
POT 0, 100, B2 ' Read potentiometer on pin 0.
SEROUT 1, N300, (B2) ' Send potentiometer reading
' over serial output.
GOTO Loop
1
S
TEPS TO FIND THE BEST SCALE
VALUE
.
Содержание 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...