BASIC stamp manual v2.2
5: BASIC Stamp Command Reference – RUN
BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com • Page 381
RUN
BS1 BS2 BS2e BS2sx BS2p BS2pe BS2px
RUN ProgramSlot
Function
Switches execution to another BASIC Stamp program (in a different
program slot).
• ProgramSlot is a variable/constant/expression (0 – 7) that specifies
the program slot to run.
Quick Facts
Table 5.91: RUN Quick Facts.
BS2e BS2sx BS2p BS2pe BS2px
Time Delay to
Switch Between
Program Slots
770 µs 300 µs 250 µs 736 µs
195 µs
Related
Commands
n/a POLLRUN
Special Notes
RUN is similar to a GOTO… you can not "return" from a RUN
Explanation
The BS2e, BS2sx, BS2p, BS2pe and BS2px have a total of 16 k bytes of code
space. This code space is organized into eight slots of 2 k bytes each. The
BS2pe has 32 k of EEPROM but only the first 16 k (eight slots) can be sued
for programs. Up to eight different programs can be downloaded to the
BASIC Stamp (one program per code slot). When the BASIC Stamp
powers up, or is reset, the program in slot 0 is executed.
The RUN command allows you to activate another program and causes
the BASIC Stamp to stay in the newly activated program until it receives
another RUN command, or until a power-down or reset condition occurs.
The RUN command is similar to a GOTO command in that it allows you
to "goto" another program. Normally a master-type program will be used
in program slot 0 (since slot 0 runs first) and will control initial execution
of the other programs.
Look at the following example (there are two programs here, make sure to
download them into program slots 0 and 1, respectively. See the Compiler
Directives section of Chapter 3 for more information):
A
SIMPLE EXAMPLE OF RUN.