BASIC stamp manual v2.2
5: BASIC Stamp Command Reference – POLLRUN
BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com • Page 331
POLLRUN
BS1 BS2 BS2e BS2sx BS2p BS2pe BS2px
POLLRUN ProgramSlot
Function
Specify a program to run upon a polled-input event.
• ProgramSlot is a variable/constant/expression (0 – 7) that specifies
the program slot to run when a polled-input event occurs.
Quick Facts
Table 5.80: POLLRUN Quick
Facts.
BS2p, BS2pe, and BS2px
Default
ProgramSlot
The default polled-run slot is 0. If no POLLRUN command is given and a
poll mode of 3 or 4 is set, the program in slot 0 will run in response to a
polled-input event.
Special Notes
• If both polled-outputs and polled-run are active, the polled-output event
will occur before the polled-run event.
Useful SPRAM
locations
Locations 128 – 135 hold polled interrupt status. See Table 5.77 in the
POLLMODE command section for more information.
Related
commands
POLLMODE, POLLIN, POLLOUT, POLLWAIT and RUN
Explanation
The POLLRUN command is used to specify a program slot to run in
response to a polled event. This activity can occur in between any two
instructions within the rest of the PBASIC program.
The "polling" commands allow the BASIC Stamp to respond to certain I/O
pin events at a faster rate than what is normally possible through manual
PBASIC programming. The term "poll" comes from the fact that the
BASIC Stamp's interpreter periodically checks the state of the designated
polled-input pins. It "polls" these pins after the end of each PBASIC
command and before it reads the next PBASIC command from the user
program; giving the appearance that it is polling "in the background".
This feature should not be confused with the concept of interrupts, as the
BASIC Stamp does not support true interrupts.