DATA - BASIC Stamp Command Reference
Page 94
•
BASIC Stamp Programming Manual 2.0b
•
www.parallaxinc.com
A common use for DATA 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 DATA
directive, and PBASIC will understand it to mean a series of bytes (see the
last line of code below). The following three DATA directives are
equivalent:
DATA 72, 69, 76, 76, 79
DATA "H", "E", "L", "L", "O"
DATA "HELLO"
All three lines of code, above, will result in the numbers 72, 69, 76, 76, and
79 being stored into EEPROM upon downloading. These numbers are
simply the ASCII character codes for "H", "E", "L", "L", and "O",
respectively. See the Demo Program, below, for an example of storing and
reading multiple text strings.
The EEPROM is organized as a sequential set of byte-sized memory
locations. By default, the DATA directive stores bytes into EEPROM. If
you try to store a word-size value (ex: DATA 1125) only the lower byte of
the value will be stored. This does not mean that you can't store word-
sized values, however. A word consists of two bytes, called a low-byte
and a high-byte. If you wanted to store the value 1125 using the DATA
directive, simply insert the prefix "word" before the number, as in:
DATA word 1125
The directive above will automatically break the word-size value into two
bytes and store them into two sequential EEPROM locations (the low-byte
first, followed by the high-byte). In this case, the low-byte is 101 and the
high byte is 4
and they will be stored in locations 0 and 1, respectively. If
you have multiple word-size values, you must prefix each value with
"word", as in:
DATA word 1125, word 2000
To retrieve a word-size value, you'll need to use two READ commands
and a word-size variable (along with some handy modifiers). For
example,
W
RITING TEXT STRINGS
.
W
RITING WORD VALUES VS
.
BYTE
VALUES
.
Содержание 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...