EasyManua.ls Logo

Parallax BASIC Stamp 2e - Page 332

Default Icon
353 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
WRITE - BASIC Stamp Command Reference
Page 330 BASIC Stamp Programming Manual 2.0b www.parallaxinc.com
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 = W0 'The full word-sized variable
SYMBOL Value_Low = B0 'B0 happens to be the low-byte of W0
SYMBOL Value_High = B1 'B1 happens to be the high-byte of W0
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
WRITING WORD VALUES VS. BYTE
VALUES
.
1
2
e
2
sx
2
p
2
1
2
e
2
sx
2
p
2
SPECIAL NOTES FOR EEPROM
USAGE.

Table of Contents

Related product manuals