Page 24 • BASIC Stamp II Manual 0.94 • Parallax, Inc. • (916) 624-8333
BASIC Stamp II
nibarray(index)
A variable followed by an expression in
quotes is indexed as an array (0=1st element).
word.bit0(bitoffset)
Scan a word, one bit at a time.
If a variable were defined as:
string var byte (10)
It could be accessed as:
string
The 1st byte
string (0)
The 1st byte
string (1)
The 2nd byte
string (9)
The 10th (last) byte
string.lownib(nibindex)
Nibindex could be 0-19
string.lowbit(bitindex)
Bitindex could be 0-79
There are also binary, unary, and conditional expression operators.
Unary operators preceed a variable or constant or (expression) and
have highest priority. They are as follows:
SQR
Square root of unsigned 16-bit value
ABS
Absolute of signed 16-bit value
~
One’s complement of 16-bit value (bitwise not)
-
Two’s complement of 16-bit value (negation)
DCD
2^n decoder of 4-bit value (0...15 -> 1,2,4,8,16,...32768)
NCD
Priority encoder of 16-bit value
(=>32768,=>16384,=>8192,...=1 -> 15,14,13,...1 ; 0 -> $FFFF)
COS
Cosine of 8-bit value. Result is in the range of +-127,
unit circle is 0-255 radial units.
SIN
Sine of 8-bit value. Result is in the range of +-127,
unit circle is 0-255 radial units.
Examples:
sin bytevar
Summary of Contents for BASIC Stamp II
Page 2: ...BLANK PAGE...