5: BASIC Stamp Command Reference - DEBUG
BASIC Stamp Programming Manual 2.0c
•
www.parallaxinc.com
•
Page 101
Signed numbers are preceded with a space ( ) or a minus sign (-) to
indicate a positive or negative number, respectively. Normally, any
number displayed by the BASIC Stamp is shown in its unsigned (positive)
form without any indicator. The signed formatters allow you to display
the number as a signed (rather than unsigned) value. NOTE: Only Word-
sized variables can be used for signed number display.
The code below
demonstrates the difference in all three numbering schemes.
x VAR WORD
x = -65
DEBUG "Signed: ", SDEC x, " ", ISHEX x, " ", ISBIN x, CR
DEBUG "Unsigned: ", DEC x, " ", IHEX x, " ", IBIN x
This code will generate the display shown below:
Signed: -65 -$41 -%1000001
Unsigned: 65471 $FFBF %1111111110111111
The signed form of the number –65 is shown in decimal, hexadecimal and
then in binary on the top line. The unsigned form, in all three number
systems, is shown on the bottom line. If the unsigned form looks strange
to you, it's because negative numbers are stored in twos-compliment
format within the BASIC Stamp.
Suppose that your program contained several DEBUG instructions
showing the contents of different variables. You would want some way to
tell them apart. One possible way is to do the following:
x VAR BYTE
y VAR BYTE
x = 100
y = 250
DEBUG "X = ", DEC x, CR ' Show decimal value of x
DEBUG "Y = ", DEC y, CR ' Show decimal value of y
but typing the name of the variables in quotes (for the display) can get a
little tedious. A special formatter, the question mark (?), can save you a lot
of time. The code below does exactly the same thing (with less typing):
D
ISPLAYING SIGNED VS
.
UNSIGNED
NUMBERS
.
A
UTOMATIC NAMES IN THE DISPLAY
.
Содержание 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...