5: BASIC Stamp Command Reference – POLLIN
BASIC Stamp Programming Manual 2.0c
•
www.parallaxinc.com
•
Page 217
continue to perform this operation, in-between each command in the loop,
endlessly.
It's important to note that, in this example, only the DEBUG and GOTO
commands are being executed over and over again. The first three lines of
code are only run once, yet their effects are "remembered" by the BASIC
Stamp throughout the rest of the program.
If the polling commands were not used, the program would have to look
like the one below in order to achieve the same effect.
INPUT 0
OUTPUT 1
Loop:
OUT1 = ~IN0
DEBUG "Looping…", CR
OUT1 = ~IN0
GOTO Loop
In this example, we create the inverse relationship of input pin 0 and
output pin 1 manually, in-between the DEBUG and GOTO lines. Though
the effects are the same as when using the polling commands, this
program actually takes a little longer to run and consumes 7 additional
bytes of program (EEPROM) space. Clearly, using the polling commands
is more efficient.
You can have as many polled-input and polled-output pins as you have
available. If multiple polled-input pins are defined, any one of them can
trigger changes on the polled-output pins that are also defined. For
example:
POLLIN 0, 1
POLLIN 1, 1
POLLOUT 2, 0
POLLOUT 3, 0
POLLMODE 2
Loop:
DEBUG "Looping…", CR
GOTO Loop
This code sets I/O pins 0 and 1 to polled-input pins (looking for a high (1)
state) and sets I/O pins 2 and 3 to polled-output pins (with a low-active
state). If either I/O pin 0 or 1 goes high, the BASIC Stamp will set I/O
F
OR COMPARISON
:
ACHIEVING THE
SAME EFFECTS WITHOUT THE POLLING
COMMANDS
.
U
SING MULTIPLE POLLED
-
INPUT AND
POLLED
-
OUTPUT PINS
.
T
HE
BASIC S
TAMP
"
REMEMBERS
"
THE POLLING CONFIGURATION FOR
THE DURATION OF THE
PBASIC
PROGRAM
.
Содержание 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...