BASIC stamp manual v2.2
RUN – BASIC Stamp Command Reference
Page 382 • BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com
' Download this program to Slot 0
DEBUG "Hello "
RUN 1
' Download this program to Slot 1
DEBUG "World!"
PAUSE 1000
RUN 0
The above two programs (assuming they have been downloaded into
program slots 0 and 1, respectively) will display "Hello World!" on the
screen. Program 0 is the first to run and it displays "Hello ", then issues a
RUN 1 command. The BASIC Stamp then starts execution of program 1,
from its first line of code, which causes "World!" to be displayed. Program
1 then pauses for 1 second and the runs program 0 again.
The I/O pins retain their current state (directions and output latches) and
all RAM and SPRAM locations retain their current data during a transition
between programs with the RUN command. If sharing data between
programs within RAM, make sure to keep similar variable declarations
(defined in the same order) in all programs so that the variables align
themselves on the proper word, byte, nibble and bit boundaries across
programs. The following programs illustrate what happens with
mismatched variable declarations:
' Download this program to Slot 0
cats VAR Byte
dogs VAR Byte
Setup:
cats = 3
dogs = 1
DEBUG ? cats
DEBUG ? dogs
RUN 1
' Download this program to Slot 1
cats VAR Byte
dogs VAR Byte
fleas VAR Word
Main:
DEBUG ? cats
DEBUG ? dogs
DEBUG ? fleas
END
W
HAT HAPPENS TO I/O PINS AND RAM
WHEN USING
RUN?