Defining Variables (Var) - Parallax BASIC Stamp II Manual

Table of Contents

Advertisement

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
mouse
var
dog
var
rhino
var
snake
var
BASIC Stamp II Manual 0.94 • Parallax, Inc. • (916) 624-8333 • Page 17
BASIC Stamp II
nib
'make "cat" a nibble variable
bit
'make "mouse" a bit variable
byte
'make "dog" a byte variable
word
'make "rhino" a word variable
bit(10)
'make "snake" a 10-piece bit variable

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the BASIC Stamp II and is the answer not in the manual?

Table of Contents