Parallax BASIC Stamp 2e Programming Manual page 224

Table of Contents

Advertisement

POLLMODE - BASIC Stamp Command Reference
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.
downloaded into program slot 0 and the second into program slot 1. We'll
assume they are called POLL0.bsp and POLL1.bsp, respectively (as
defined in the STAMP directive lines).
' ----- program #1 (slot 0) -----
' {$STAMP BS2p, POLL1.bsp}
POLLIN 0, 1
POLLOUT 1, 1
POLLRUN 1
POLLMODE 4
Loop:
DEBUG "Program 1", CR
GOTO Loop
' ----- program #2 (slot 1) -----
' {$STAMP BS2p}
DEBUG "Switching...", CR
Loop:
DEBUG "Program 2", CR
GOTO Loop
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 high
state and polled-output 1 to go high in response.
configures a polled-run activity (see the POLLRUN description for more
information) to run the program in slot 1.
activates the polled-output and the polled-run.
continuously prints "Program 1" on the PC screen.
Once I/O pin 0 goes high, 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 first print "Switching..." on the PC screen and then will
continuously print "Program 2". From this point forward, I/O pin 1 will
continue to be set low and high in response to changes occurring on I/O
Page 222 • BASIC Stamp Programming Manual 2.0b • www.parallaxinc.com
The first should be
Program 1 also
The POLLMODE setting
Then, program 1

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the BASIC Stamp 2e and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents