BASIC Stamp II Manual 0.94 • Parallax, Inc. • (916) 624-8333 • Page 17
BASIC Stamp II
Words $3-$F are for general purpose variable use and have no pre-
assigned symbolic names. The VAR statement is used to allocate this
memory.
The above text introduced the physical pin-out of the BASIC Stamp II,
as well as the internal EEPROM, RAM, and I/O structure. The follow-
ing text discusses the programming of the BS2.
Programming the BASIC Stamp II
In the BASIC Stamp II, there are two general categories of BASIC state-
ments: compile-time and run-time.
Compile-time statements are resolved when you compile the
program (Alt-R or Alt-M), and they do not generate any executable
code.
Run-time statements generate code and are executed at run-time.
There are three compile-time statements. They are used for declaring
variables, constants, and data. They are:
VAR, CON, and DATA
The VAR statment - defining variables
Your program should begin with a declaration of all of its variables.
VAR statements assign symbolic names to variable RAM (RAM not
used by I/O - words $3-$F). This is done as follows:
‘Declare the variables
cat var nib ‘make “cat” a nibble variable
mouse var bit ‘make “mouse” a bit variable
dog var byte ‘make “dog” a byte variable
rhino var word ‘make “rhino” a word variable
snake var bit(10) ‘make “snake” a 10-piece bit variable