Specifications

Appendix C
Parallax, Inc. • BASIC Stamp Programming Manual 1.8 • Page 379
C
To define a variable of a specific type, use the following format.
variablename VAR [ type{(arraysize)} | previousvariable{.modifier{.modifier...}} ]
Example:
LoopCounter VAR WORD 'defines LoopCounter as a word.
LoopCounter2 VAR BYTE(2) 'defines LoopCounter2 as an array of
'two bytes.
FirstBit VAR LoopCounter.LOWBIT 'defines FirstBit as the lowest bit
'within the variable LoopCounter.
VARIABLENAME is a series of characters (letters, numbers and
underscores but not starting with a number) up to 32 characters in
length.
TYPE is a valid variable type of BIT, NIB, BYTE or WORD.
• ARRAYSIZE is an optional constant value, in parentheses, speci-
fying the number of elements of TYPE to define for the variable
VARIABLENAME.
PREVIOUSVARIABLE is the name of a previously defined vari-
able. This can be used to assign alias names to the same variable
space.
MODIFIER is an optional offset, preceded by a period ‘.’, which
indicates which part of a previously defined variable to set
VARIABLENAME to. Valid modifiers are: LOWBYTE,
HIGHBYTE, BYTE0..1, LOWNIB, HIGHNIB, NIB0..3, LOWBIT,
HIGHBIT and BIT0..15.
You may define a constant by using a similar format:
constantname CON constantexpression
Example:
MaxLoops CON 100 'defines MaxLoops as a constant
'equivalent to the number 100.
MaxLoops2 CON 50 * 4 / 2 'also defines MaxLoops as a
'constant equivalent to the number 100.