DEBUG - BASIC Stamp Command Reference
x
VAR
BYTE
y
VAR
BYTE
x = 100
y = 250
DEBUG DEC ? x
DEBUG DEC ? y
The display would look something like this:
x = 100
y = 250
The ? formatter always displays data in the form "symbol = value"
(followed by a carriage return). In addition, it defaults to displaying in
decimal, so we really only needed to type: DEBUG ? x for the above
code. You can, of course, use any of the three number systems. For
example: DEBUG HEX ? x or DEBUG BIN ? y.
It's important to note that the "symbol" it displays is taken directly from
what appears to the right of the ?. If you were to use an expression, for
example: DEBUG ? x*10/2+3 in the above code, the display would
show: "x*10/2+3 = 503".
A special formatter, ASC, is also available for use only with the ? formatter
to display ASCII characters, as in: DEBUG ASC ? x.
What if you need to display a table of data; multiple rows and columns?
The Signed/Unsigned code (above) approaches this but, if you notice, the
columns don't line up. The number formatters (DEC, HEX and BIN) have
some useful variations to make the display fixed-width (see Table 6.3). Up
to 5 digits can be displayed for decimal numbers. To fix the value to a
specific number of decimal digits, you can use DEC1, DEC2, DEC3, DEC4
or DEC5. For example:
x
VAR
BYTE
x = 165
DEBUG DEC5 x
displays "00165". Notice that leading zeros? The display is "fixed" to 5
digits, no more and no less. Any unused digits will be filled with zeros.
Page 102 • BASIC Stamp Programming Manual 2.0b • www.parallaxinc.com
' Show decimal value of x
' Show decimal value of y
' Show decimal value of x in 5 digits.
D
-
ISPLAYING FIXED
WIDTH NUMBERS
.
Need help?
Do you have a question about the BASIC Stamp 2e and is the answer not in the manual?