DATA - BASIC Stamp Command Reference
Page 92
•
BASIC Stamp Programming Manual 2.0b
•
www.parallaxinc.com
DATA 72, 69, 76, 76, 79
DATA 104, 101, 108, 108, 111
The first DATA directive will start at location 0 and increment the pointer
for each data value it stores (1, 2, 3, 4 and 5). The second DATA 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 DATA directive has an option to specify the next location to use. You
can specify the next location number (to set the pointer to) by inserting a
DataItem in the form @x ;where x is the location number. The following
code writes the same data in Table 5.4 to locations 100 through 109:
DATA @100, 72, 69, 76, 76, 79, 104, 101, 108, 108, 111
In this example, the first DataItem is @100. This tells the DATA directive to
store the following DataItem(s) starting at location 100. All the DataItems to
the right of the @100 are stored in their respective locations (100, 101,
102… 109).
In addition, the DATA directive allows you to specify new starting
locations at any time within the DataItem list. If, for example, you wanted
to store 56 at location 100 and 47 at location 150 (while leaving every other
location intact), you could type the following:
DATA @100, 56, @150, 47
If you have multiple DATA directives in your program, it may be difficult
to remember exactly what locations contain the desired data. For this
reason, the DATA directive can optionally be prefixed with a unique
symbol name. This symbol becomes a constant that is set equal to the
location number of the first byte of data within the directive. For example,
MyNumbers DATA @100, 72, 73
This would store the values 72 and 73 starting with location 100 and will
create a constant, called MyNumbers, which is set equal to 100. Your
Table 5.4: Example EEPROM
storage.
W
RITING DATA TO OTHER LOCATIONS
.
A
UTOMATIC CONSTANTS FOR DEFINED
DATA
.
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...