Parallax BASIC Stamp 2e Programming Manual page 95

Table of Contents

Advertisement

R
EEPROM
ESERVING
LOCATIONS
I
: H
MPORTANT CONCEPT
OW DATA
AND PROGRAMS ARE DOWNLOADED
EEPROM.
W
RITING A BLOCK OF THE SAME
.
VALUE
5: BASIC Stamp Command Reference - DATA
program can then use the MyNumbers constant as a reference to the start of
the data within a READ or WRITE command. Each DATA directive can
have a unique symbol preceding it, allowing you to reference the data
defined at different locations.
There may be a time when you wish to reserve a section of EEPROM for
.
use by your BASIC code, but not necessarily store data there to begin with.
To do this, simply specify a DataItem within parentheses, as in:
DATA
@100, (20)
The above DATA directive will reserve 20 bytes of EEPROM, starting with
location 100. It doesn't store any values there, rather it simply leaves the
data as it is and increments DATA's location pointer by 20. A good reason
to do this is when you have a program already downloaded into the
BASIC Stamp that has created or manipulated some data in EEPROM. To
protect that section of EEPROM from being overwritten by your next
program (perhaps a new version of the same program) you can reserve the
space as shown above. The EEPROM's contents from locations 100 to 119
will remain intact. NOTE: This only "reserves" the space for the program
you are currently downloading; the BASIC Stamp does not know to
"reserve" the space for future programs. In other words, make sure use
this feature of the DATA directive in every program you download if you
don't want to risk overwriting valuable EEPROM data.
It is important to realize that EEPROM is not overwritten during
programming unless it is needed for program storage, or is filled by a
DATA directive specifying data to be written. During downloading,
EEPROM is always written in 16-byte sections if, and only if, any
location within that section needs writing.
DATA can also store the same number in a block of consecutive locations.
This is similar to reserving a block of EEPROM, above, but with a value
added before the first parenthesis. For example,
DATA
@100, 0 (20)
This statement writes the value 0 in all the EEPROM locations from 100 to
119.
BASIC Stamp Programming Manual 2.0c • www.parallaxinc.com • Page 93

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