Specifications
BASIC Stamp II
Parallax, Inc. • BASIC Stamp Programming Manual 1.8 • Page 339
2
Write
WRITE
address,byte
Write a byte of data to the EEPROM.
•
Address
is a variable/constant specifying the EEPROM address
(0—2047) to write to.
•
Byte
is a data byte to be written into EEPROM.
Explanation
The EEPROM is used for both program storage (which builds down-
ward from address 2047) and data storage (which may use any EEPROM
byte not used for program storage). Data may either be downloaded to
the BS2 along with the program via the Data directive, or a running
program may store data in EEPROM using the Write instruction.
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 accept a finite number of Write cycles per
byte before it wears out. At the time of this writing, each byte of
the EEPROM used in the BS2 was good for 10 million Write
cycles, and an unlimited number of Reads. If a program frequently
writes to the same EEPROM location, it makes sense to estimate
how long it might take to exceed 10 million writes. For example,
at one write per second (86,400 writes/day) it would take nearly
116 days of continuous operation to exceed 10 million.
(3) The primary function of the EEPROM is to store programs;
data is stored in leftover space. If data overwrites a portion of
your program, the program will most likely crash. Check the
program’s memory map to determine what portion of memory is
occupied by your program and make sure that EEPROM Writes
cannot stray into this area. You may also use the Data directive to
set aside EEPROM space. For instance:










