BASIC stamp manual v2.2

5: BASIC Stamp Command Reference – POLLMODE
BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com Page 319
POLLMODE
BS1 BS2 BS2e BS2sx BS2p BS2pe BS2px
POLLMODE Mode
Function
Specify a polled command mode.
Mode is a variable/constant/expression (0 – 15) that indicates the
mode in which to process the polled command configuration.
Quick Facts
Table 5.75: POLLMODE Quick
Facts.
BS2p, BS2pe, and BS2px
Special Notes
Polled-output pins will either change states continuously, just once or
not at all, depending on the POLLMODE command.
A poll-mode of 2 or 4 is required for a POLLWAIT command to work.
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 for
more information.
Related
Commands
POLLIN, POLLOUT, POLLRUN and POLLWAIT
Explanation
The POLLMODE command is used to specify the mode in which polling
events and activities are processed. This activity will occur in-between
instructions during 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.
The POLLMODE command sets one of 15 possible modes for the polling
commands. It is used mainly before and/or after any POLLIN, POLLOUT
or POLLRUN commands to disable and enable the polling features as
desired. Table 5.76 shows the mode values and their effect.