EasyManua.ls Logo

Parallax BASIC Stamp 2e - Page 235

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...
5: BASIC Stamp Command Reference POLLRUN
BASIC Stamp Programming Manual 2.0c www.parallaxinc.com Page 233
Demo Program (POLLRUN0.bsp)
' This program demonstrates the POLLRUN command. It is intended to be downloaded
' to program slot 0, and the program called PROGRUN1.BSP should be downloaded to
' program slot 1. I/O pin 0 is set to watch for a high signal. Once the Loop routine
' starts running, the program constant prints it's program slot number to the screen. If I/O
' pin 0 goes high, the program in program slot 1 (which should be POLLRUN1.BSP) is run.
'{$STAMP BS2p, PollRun1.bsp} 'STAMP directive (specifies a BS2p)
ProgSlot VAR BYTE
Init:
POLLIN 0, 1 'Set I/O 0 to polled-input looking for a high
POLLRUN 1 'Set polled-run to program slot 1
POLLMODE 3 'Set mode to enable polled-outputs and polled wait
Loop:
GET 127, ProgSlot
DEBUG "Running Program #", DEC ProgSlot.LOWNIB, CR
GOTO Loop
Demo Program (POLLRUN1.bsp)
' This program demonstrates the POLLRUN command. It is intended to be downloaded
' to program slot 1, and the program called PROGRUN0.BSP should be downloaded to
' program slot 0. This program is run when program 0 detects a high on I/O pin 0
' via the polled commands.
ProgSlot VAR BYTE
Loop:
GET 127, ProgSlot
DEBUG "Running Program #", DEC ProgSlot.LOWNIB, CR
GOTO Loop
p
2
p
2

Table of Contents

Related product manuals