BASIC stamp manual v2.2

READ – BASIC Stamp Command Reference
Page 370 BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com
The following READ command retrieves the value at location 100 and
stores it into the variable called result:
SYMBOL result = B2
READ 100, result
--or--
result VAR Byte
READ 100, result
The EEPROM is organized as a sequential set of byte-sized memory
locations. The READ command normally only retrieves byte-sized values
from EEPROM. This does not mean that you can't read word-sized
values, however. A word consists of two bytes, called a low-byte and a
high-byte. With PBASIC 1.0 or 2.0, if you want to read a word-sized value,
you'll need to use two READ commands and a word-sized variable.
SYMBOL result = W0
SYMBOL resltLo = B0
SYMBOL resltHi = B1
EEPROM (101, 4)
READ 0, resltLo 'read low byte
READ 1, resltHi 'read high byte
DEBUG #result
--or--
result VAR Word
DATA Word 1125
READ 0, result.LOWBYTE 'read low byte
READ 1, result.HIGHBYTE 'read high byte
On all BS2 models, by using the $PBASIC 2.5 directive, you can use a
single READ command with the WORD modifier. For example,
R
EADING WORD VALUES VS. BYTE VALUES.
A
SIMPLE READ COMMAND.
1
All
2
1
All
2
NOTE: this method is required only if
using PBASIC 2.0. See section below
for PBASIC 2.5 method.