BASIC stamp manual v2.2

5: BASIC Stamp Command Reference – READ
BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com Page 369
READ
BS1 BS2 BS2e BS2sx BS2p BS2pe BS2px
READ Location, Variable
READ Location, { WORD } Variable {, { WORD } Variable... }
Function
Read the value at Location in EEPROM and store the result in Variable.
Location is a variable/constant/expression (0 – 255 on BS1, 0 – 2047
on all BS2 models) that specifies the EEPROM address to read from.
Variable is a variable (usually a byte, or word when the optional
WORD modifier is used) in which to store the value.
Quick Facts
Table 5.88: READ Quick Facts.
BS1 BS2, BS2e, BS2sx BS2p, BS2pe, BS2px
Range of
EEPROM
Locations
0 to 255 0 to 2047
0 to 2047
(see notes below)
Special
Notes
n/a
READ only works with
current program slot on
BS2e and BS2sx.
READ works with any
program slot as set by
the STORE command.
Related
Commands
WRITE and EEPROM WRITE and DATA WRITE, DATA and STORE
PBASIC 2.5
Syntax
Options
n/a
Multiple sequential variables may be read from the
Scratch Pad RAM, and the optional WORD modifier
may be specified to retrieve 16-bit values.
Explanation
The EEPROM is used for both program storage (which builds downward
from address 255 on BS1, 2047 on all BS2 models) and data storage (which
builds upward from address 0). The READ instruction retrieves a value
from any EEPROM address and stores that value in Variable. When the
optional WORD modifier is used, the low byte of Variable is read from
Location, the high byte of Variable from Location + 1. Any location within
the EEPROM can be read (including your PBASIC program's tokens) at
run-time. This feature is mainly used to retrieve long-term data from
EEPROM; data stored in EEPROM is not lost when the power is removed.
NOTE: Expressions are not allowed as
arguments on the BS1.
1
1
All
2
NOTE: Optional arguments
require PBASIC 2.5.