EasyManua.ls Logo

Parallax BASIC Stamp 2e - Page 224

Default Icon
353 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
POLLMODE - BASIC Stamp Command Reference
Page 222 BASIC Stamp Programming Manual 2.0b www.parallaxinc.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. 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. 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 "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

Table of Contents

Related product manuals