Parallax BASIC Stamp 2e Programming Manual page 332

Table of Contents

Advertisement

WRITE - BASIC Stamp Command Reference
WRITE 100, 245
--or--
WRITE 100, 245
The EEPROM is organized as a sequential set of byte-sized memory
locations.
The WRITE command only stores byte-sized values into
EEPROM. This does not mean that you can't write word-sized values,
however. A word consists of two bytes, called a low-byte and a high-byte.
If you wanted to write a word-sized value, you'll need to use two WRITE
commands and a word-size value or variable (along with some handy
modifiers). For example,
SYMBOL
Value
SYMBOL
Value_Low
SYMBOL
Value_High
Value = 1125
WRITE
0, Value_Low
WRITE
1, Value_High
--or--
Value
VAR
WORD
WRITE
0, Value.LOWBYTE
WRITE
1, Value.HIGHBYTE
When this program runs, the two WRITE commands will store the low-
byte and high-byte of the number 1125 into EEPROM.
EEPROM differs from RAM, the memory in which variables are stored, in
several respects:
1.
Writing to EEPROM takes more time than storing a value in a
variable. Depending on many factors, it may take several
milliseconds for the EEPROM to complete a write. RAM storage is
nearly instantaneous.
2.
The EEPROM can only accept a finite number of write cycles per
location before it wears out. Table 5.94 indicates the guaranteed
number of writes before failure. If a program frequently writes to
the same EEPROM location, it makes sense to estimate how long it
Page 330 • BASIC Stamp Programming Manual 2.0b • www.parallaxinc.com
= W0
'The full word-sized variable
= B0
'B0 happens to be the low-byte of W0
= B1
'B1 happens to be the high-byte of W0
1
2
2
2
2
e
p
sx
W
.
RITING WORD VALUES VS
.
VALUES
1
2
2
2
2
e
sx
p
S
EEPROM
PECIAL NOTES FOR
.
USAGE
BYTE

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Table of Contents