BASIC stamp manual v2.2

5: BASIC Stamp Command Reference – WRITE
BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com Page 461
' {$PBASIC 2.5}
value VAR Word
value = 1125
WRITE 0, Word value ' write two bytes
When using PBASIC 2.5, a single WRITE command can write multiple
bytes and words to sequential EEPROM locations. For example:
' {$PBASIC 2.5}
value VAR Byte
value2 VAR Word
value = 18
value2 = 1125
WRITE 25, value, Word value2 ' write byte to location 25
' and word to locations 26 and 27
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.123 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
might take to exceed the guaranteed maximum. For example, on
the BS2, 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
your program occupies and make sure that EEPROM writes cannot stray
into this area. You may also use the DATA directive on all BS2 models to
set aside EEPROM space.
SPECIAL NOTES FOR EEPROM USAGE.
All
2
All
2