EasyManua.ls Logo

Parallax BASIC Stamp 2e - Page 104

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...
DEBUG - BASIC Stamp Command Reference
Page 102 BASIC Stamp Programming Manual 2.0b www.parallaxinc.com
x VAR BYTE
y VAR BYTE
x = 100
y = 250
DEBUG DEC ? x ' Show decimal value of x
DEBUG DEC ? y ' Show decimal value of 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 ' Show decimal value of x in 5 digits.
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.
DISPLAYING FIXED-WIDTH NUMBERS.

Table of Contents

Related product manuals