5: BASIC Stamp Command Reference - DEBUG
BASIC Stamp Programming Manual 2.0c
•
www.parallaxinc.com
•
Page 103
Using DEC4 in the same code would display "0165". DEC3 would display
"165". What would happen if we used DEC2? Regardless of the number,
the BASIC Stamp will ensure that it is always the exact number of digits
you specified. In this case, it would truncate the "1" and only display "65".
Using the fixed-width version of the formatters in the Signed/Unsigned
code above, may result in the following code:
x VAR WORD
x = -65
DEBUG "Signed: ", SDEC5 x, " ", ISHEX4 x, " ", ISBIN16 x, CR
DEBUG "Unsigned: ", DEC5 x, " ", IHEX4 x, " ", IBIN16 x
and displays:
Signed: -00065 -$0041 -%0000000001000001
Unsigned: 65471 $FFBF %1111111110111111
Note: The columns don't line up exactly (due to the extra "sign" characters
in the first row), but it certainly looks better than the alternative.
If you have a string of characters to display (a byte array), you can use the
STR formatter to do so. The STR formatter has two forms (as shown in
Table 6.3) for variable-width and fixed-width data. The example below is
the variable-width form.
x VAR BYTE(5)
x(0) = "A"
x(1) = "B"
x(2) = "C"
x(3) = "D"
x(4) = 0
DEBUG STR x
This code displays "ABCD" on the screen. In this form, the STR formatter
displays each character contained in the byte array until it finds a
character that is equal to 0 (value 0, not "0"). This is convenient for use
with the SERIN command's STR formatter, which appends 0's to the end
of variable-width character string inputs. NOTE: If your byte array
doesn't end with 0, the BASIC Stamp will read and output all RAM
register contents until it finds a 0 or until it cycles through all RAM
locations.
D
ISPLAYING STRINGS
(
BYTE ARRAYS
).
V
ARIABLE
-
WIDTH STRINGS
.
Содержание 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...