BASIC stamp manual v2.2
POLLMODE – BASIC Stamp Command Reference
Page 322 • BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com
acts just like it did initially for the remainder of the program. The ability
to temporarily disable polling, without changing the configuration, can be
a powerful feature for certain "critical" parts of a program.
The following example contains two programs. The first should be
downloaded into program slot 0 and the second into program slot 1.
' Pgm #1 (Slot 0) -------------
POLLIN 0, 0
POLLOUT 1, 1
POLLRUN 1
POLLMODE 4
Main:
DEBUG "Running Program 1", CR
GOTO Main
' Pgm #2 (Slot 1) -------------
Main:
DEBUG "Running Program 2", CR
GOTO Main
In this example (containing two programs; one is slot 0 and the other in
slot 1) program 1 (slot 0) will configure polled-input pin 0 to detect a low
state and polled-output 1 to go high in response. Program 1 also
configures a polled-run activity (see the POLLRUN description for more
information) to run the program in slot 1. The POLLMODE setting
activates the polled-output and the polled-run. Then, program 1
continuously prints "Running Program 1" on the PC screen.
Once I/O pin 0 goes low, however, the BASIC Stamp will set I/O pin 1
high, then execution will be switched to the program in slot 1 (program 2).
Program 2 will continuously print "Running Program 2" on the screen.
From this point forward, I/O pin 1 will continue to be set low and high in
response to changes occurring on I/O pin 0, but the polled-run activity is
disabled and the BASIC Stamp endlessly runs the code in program 2's
Main routine.
The highest locations of Scratch Pad RAM contain run-time information
about polled interrupts. See Table 5.77 below.