EEPROM - BASIC Stamp Command Reference
Page 112
•
BASIC Stamp Programming Manual 2.0b
•
www.parallaxinc.com
subsequent EEPROM directives start with the pointer value left by the
previous EEPROM directive. For example, if the program contains:
EEPROM (72, 69, 76, 76, 79)
EEPROM (104, 101, 108, 108, 111)
The first EEPROM directive will start at location 0 and increment the
pointer for each data value it stores (1, 2, 3, 4 and 5). The second EEPROM
directive will start with the pointer value of 5 and work upward from
there. As a result, the first 10 bytes of EEPROM will look like the
following:
EEPROM Location (address)
0
1
2
3
4
5
6
7
8
9
Contents
72
69
76
76
79
104
101
108
108
111
What if you don’t want to store values starting at location 0? Fortunately,
the EEPROM directive has an option to specify the next location to use.
You can specify the next location number (to set the pointer to) by using
the optional Location argument before the list of Dataitems. The following
code writes the same data in Table 5.9 to locations 50 through 59:
DATA 50, (72, 69, 76, 76, 79, 104, 101, 108, 108, 111)
In this example, the Location argument is given and tells the EEPROM
directive to store the following DataItem(s) starting at location 50. The
DataItems in the list are stored in their respective locations (50, 51, 52…
59).
It is important to realize that the entire BASIC Stamp 1 EEPROM is
overwritten during programming. Any EEPROM location not containing
a PBASIC program or DataItems from an EEPROM directive is written
with a 0.
A common use for EEPROM is to store strings; sequences of bytes
representing text. PBASIC converts quoted text like "A" into the
corresponding ASCII character code (65 in this case). To make data entry
easier, you can place quotes around a whole chunk of text used in a
EEPROM directive, and PBASIC will understand it to mean a series of
bytes (see the last line of code below). The following three EEPROM
directives are equivalent:
W
RITING DATA TO OTHER LOCATIONS
.
W
RITING TEXT STRINGS
.
I
MPORTANT CONCEPT
:
H
OW DATA
AND PROGRAMS ARE DOWNLOADED
EEPROM.
Table 5.9: Example EEPROM
storage.
Summary of Contents for BASIC Stamp 1
Page 1: ...BASIC Stamp Programming Manual Version 2 0c...
Page 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...