POLLRUN - BASIC Stamp Command Reference
Page 232
•
BASIC Stamp Programming Manual 2.0b
•
www.parallaxinc.com
POLLIN 0, 1
POLLRUN 1
POLLMODE 3
Loop:
DEBUG "Waiting in Program Slot 0…", CR
GOTO Loop
The first line of the above code will set up I/O pin 0 as a polled-input pin
looking for a high (1) state. The second line, POLLRUN, tells the BASIC
Stamp that when I/O pin 0 goes high, it should switch execution over to
the program residing in program slot 1. The third line, POLLMODE,
activates the polled-run configuration.
Once the BASIC Stamp reaches the Loop routine, it will continuously print
"Waiting in Program Slot 0…" on the PC screen. In between reading the
DEBUG and GOTO commands, however, the BASIC Stamp will poll I/O
pin 0 and check for a high or low state. If the state of pin 0 is low, it will
do nothing and continue as normal. If the state of pin 1 is high, it will
switch execution over to the program in slot 1 (the second program is not
shown in this example). The switch to another program slot works exactly
like with the RUN command; the designated program is run and the
BASIC Stamp does not "return" to the previous program (similar to a
GOTO command).
Note that in order for the polled-run activity to occur, the poll mode must
be set to either 3 or 4 (the two modes that activate polled-run). Also note,
that the polled-run modes, 3 and 4, are unique. As soon as the polled-run
action occurs, the mode switches to 1 (deactivated, saved) or 2 (activated,
outputs), respectively. This is so that the BASIC Stamp doesn't
continuously go to the start of the designated program slot while the
polled-inputs are in the desired poll state. Without this "one shot" feature,
your program would appear to lock-up as long as the polled-inputs are in
the designated state.
After the program switch takes place, the Slot value is maintained. Any
future change to poll mode 3 or 4, without another POLLRUN command,
will result in the previously defined program slot being used.
Содержание BASIC Stamp 2e
Страница 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...