5: BASIC Stamp Command Reference - DEBUG
BASIC Stamp Programming Manual 2.0c
•
www.parallaxinc.com
•
Page 99
Two pre-defined symbols, CR and CLS, can be used to send a carriage-
return or clear-screen command to the Debug Terminal. The CR symbol
will cause the Debug Terminal to start a new line and the CLS symbol will
cause the Debug Terminal to clear itself and place the cursor at the top-left
corner of the screen. The following code demonstrates this.
DEBUG "You can not see this.", CLS, "Here is line 1", CR, "Here is line 2"
When the above is run, the final result is "Here is line 1" on the first line of
the screen and "Here is line 2" on the second line. You may or may not
have seen "You can not see this." appear first. This is because it was
immediately followed by a clear-screen symbol, CLS, which caused the
display to clear the screen before displaying the rest of the information.
NOTE: The rest of this discussion does not apply to the BASIC Stamp 1.
BASIC Stamp 2, 2e, 2sx and 2p Formatting
On the all BASIC Stamps except the BS1, the DEBUG command, by
default, displays everything as ASCII characters. What if you want to
display a number? You might think the following example would do this:
x VAR BYTE
x = 65
DEBUG x ' Try to show decimal value of x.
Since we set X equal to 65 (in line 2), you might expect the DEBUG line to
display “65” on the screen. Instead of “65”, however, you’ll see the letter
“A” if you run this example. The problem is that we never told the BASIC
Stamp how to output X, and it defaults to ASCII (the ASCII character at
position 65 is “A”). Instead, we need to tell it to display the “decimal
form” of the number in X. We can do this by using the decimal formatter
(DEC) before the variable. The example below will display “65” on the
screen.
x VAR BYTE
x = 65
DEBUG DEC x ' Show decimal value of x.
In addition to decimal (DEC), DEBUG can display numbers in
hexadecimal (HEX) and binary (BIN). See Table 6.3 for a complete list of
formatters.
2
e
2
sx
2
p
2
U
SING
CR
AND
CLS (BS1).
D
ISPLAYING
ASCII
CHARACTERS
.
D
ISPLAYING DECIMAL NUMBERS
.
D
ISPLAYING HEXADECIMAL AND
BINARY NUMBERS
.
Содержание BASIC Stamp 1
Страница 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...