EasyManua.ls Logo

Parallax BASIC Stamp 2e - Page 101

Default Icon
353 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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
USING CR AND CLS (BS1).
D
ISPLAYING ASCII CHARACTERS.
D
ISPLAYING DECIMAL NUMBERS.
D
ISPLAYING HEXADECIMAL AND
BINARY NUMBERS.

Table of Contents

Related product manuals