BASIC stamp manual v2.2

5: BASIC Stamp Command Reference – POLLRUN
BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com Page 333
Demo Program (POLLRUN0.bsp)
' POLLRUN0.bsp
' This program demonstrates the POLLRUN command. It is intended to be
' downloaded to program slot 0, and the program called POLLRUN1.bsp
' should be downloaded to program slot 1. I/O pin 0 is set to watch for
' a low signal. Once the Main routine starts running, the program
' continuously prints it's program slot number to the screen. If I/O
' pin 0 goes low, the program in program slot 1 (which should be
' POLLRUN1.bsp) is run.
' {$STAMP BS2p, POLLRUN1.BSP}
' {$PBASIC 2.5}
pgmSlot VAR Byte
Setup:
POLLIN 0, 0 ' polled-input, look for 0
POLLRUN 1 ' run slot 1 on polled activation
POLLMODE 3 ' enable polling
Main:
GET 127, pgmSlot
DEBUG "Running Program #", DEC pgmSlot.LOWNIB, CR
GOTO Main
END
Demo Program (POLLRUN1.bsp)
' POLLRUN1.bsp
' This program demonstrates the POLLRUN command. It is intended to be
' downloaded to program slot 1, and the program called POLLRUN0.bsp
' should be downloaded to program slot 0. This program is run when
' program 0 detects a low on I/O pin 0 via the polled commands.
' {$STAMP BS2p}
' {$PBASIC 2.5}
pgmSlot VAR Byte
Main:
GET 127, pgmSlot
DEBUG "Running Program #", DEC pgmSlot.LOWNIB, CR
GOTO Main
END
NOTE: This example program can be
used with the BS2p, BS2pe, and
BS2px by changing the $STAMP
directive accordingly.
NOTE: This example program can be
used with the BS2p, BS2pe, and
BS2px by changing the $STAMP
directive accordingly.