Specifications

BASIC Stamp II
Page 254 • BASIC Stamp Programming Manual 1.8 • Parallax, Inc.
x var byte: x = 65
DEBUG dec ? 2*(x-1) ' Show decimal result with "2*(x-1) = "
The Debug window would display "2*(x-1) = 128." If you omit the ?, the
display would be just “128.” If you tell Debug to display a value without
formatting it as a number, you get the ASCII character equivalent of the
value:
x var byte: x = 65
DEBUG x ' Show x as ASCII.
Since x = 65, and 65 is the ASCII character code for the letter A (see
appendix), the Debug window would show A. Up to now, we’ve shown
Debug with just one argument, but you can display additional items by
adding them to the Debug list, separated by commas:
x var byte: x = 65
DEBUG "The ASCII code for A is: ", dec x ' Show phrase, x.
Since individual Debug instructions can grow to be fairly complicated,
and since a program can contain many Debugs, you’ll probably want to
control the formatting of the Debug screen. Debug supports six format-
ting characters:
Symbol Value Effect
CLS 0 clear Debug screen
HOME 1 home cursor to top left corner of screen
BELL 7 beep the PC speaker
BKSP 8 back up one space
TAB 9 tab to the next multiple-of-8 text column
CR 13 carriage return to the beginning of the next line
Try the example below with and without the CR at the end of the first
Debug:
Debug "A carriage return",CR
Debug "starts a new line"
Technical Background
Debug is actually a special case of the Serout instruction. It is set for
inverted (RS-232-compatible) serial output through the BS2 program-
ming connector (SOUT on the BS2-IC) at 9600 baud, no parity, 8 data
bits, and 1 stop bit. You may view Debug output using a terminal
program set to these parameters, but you must modify either your