READ - BASIC Stamp Command Reference
Page 262
•
BASIC Stamp Programming Manual 2.0b
•
www.parallaxinc.com
The EEPROM is organized as a sequential set of byte-sized memory
locations. The READ command only retrieves byte-sized values from
EEPROM. This does not mean that you can't read word-sized values,
however. A word consists of two bytes, called a low-byte and a high-byte.
If you wanted to read a word-sized value, you'll need to use two READ
commands and a word-size variable (along with some handy modifiers).
For example,
SYMBOL Result = W0 'The full word-sized variable
SYMBOL Result_Low = B0 'B0 happens to be the low-byte of W0
SYMBOL Result_High = B1 'B1 happens to be the high-byte of W0
EEPROM (101, 4) 'Store word-sized value in locations 0 and 1
READ 0, Result_Low
READ 1, Result_High
DEBUG #Result
--or--
Result VAR WORD
DATA word 1125 'Store word-sized value in locations 0 and 1
READ 0, Result.LOWBYTE
READ 1, Result.HIGHBYTE
DEBUG DEC Result
This code uses the EEPROM or DATA directive to write the low-byte and
high-byte of the number 1125 into locations 0 and 1 during download.
When the program runs, the two READ commands will read the low-byte
and high-byte out of EEPROM (reconstructing it in a word-size variable)
and then display the value on the screen.
Note that the EEPROM and DATA directives store data in the EEPROM
before the program runs, however, the WRITE command can be used to
store data while the program is running. Additionally, the EEPROM
locations can be read an unlimited number of times, but EEPROM
locations can be worn out by excessive writes. See the WRITE command
for more information.
When using the READ and WRITE commands, take care to ensure that
your program doesn’t overwrite itself. On the BS1, location 255 holds the
address of the last instruction in your program. Therefore, your program
can use any space below the address given in location 255. For example, if
R
EADING WORD VALUES VS
.
BYTE
VALUES
.
1
2
e
2
sx
2
p
2
S
PECIAL NOTES FOR
EEPROM
USAGE
.
1
Содержание BASIC Stamp 2e
Страница 1: ...BASIC Stamp Programming Manual Version 2 0c...
Страница 30: ...Introduction to the BASIC Stamps Page 28 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 90: ...BUTTON BASIC Stamp Command Reference Page 88 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 118: ...END BASIC Stamp Command Reference Page 116 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 128: ...FREQOUT BASIC Stamp Command Reference Page 126 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 196: ...NAP BASIC Stamp Command Reference Page 194 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 206: ...OWIN BASIC Stamp Command Reference Page 204 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 214: ...OWOUT BASIC Stamp Command Reference Page 212 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 216: ...PAUSE BASIC Stamp Command Reference Page 214 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 226: ...POLLMODE BASIC Stamp Command Reference Page 224 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 232: ...POLLOUT BASIC Stamp Command Reference Page 230 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 236: ...POLLRUN BASIC Stamp Command Reference Page 234 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 240: ...POLLWAIT BASIC Stamp Command Reference Page 238 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 262: ...RCTIME BASIC Stamp Command Reference Page 260 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 274: ...RUN BASIC Stamp Command Reference Page 272 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 310: ...SEROUT BASIC Stamp Command Reference Page 308 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 324: ...STOP BASIC Stamp Command Reference Page 322 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...