BASIC stamp manual v2.2

5: BASIC Stamp Command Reference – DEBUG
BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com Page 159
DEBUG
BS1 BS2 BS2e BS2sx BS2p BS2pe BS2px
DEBUG OutputData { , OutputData }
Function
Display information on the PC screen within the BASIC Stamp Editor’s
Debug Terminal. This command can be used to display text or numbers in
various formats on the PC screen in order to follow program flow (called
debugging) or as part of the functionality of the BASIC Stamp application.
OutputData is a variable/constant/expression (0 – 65535) that
specifies the information to output. Valid data can be ASCII
characters (text strings and control characters), decimal numbers (0 -
65535), hexadecimal numbers ($0000 - $FFFF) or binary numbers (up
to %1111111111111111). Data can be modified with special
formatters as explained below.
Quick Facts
Table 5.9: DEBUG Quick Facts.
BS1
BS2, BS2e, BS2sx
BS2p, BS2pe
BS2px
Serial
Protocol
Asynchronous
4800, N, 8, 1
True polarity
Custom packetized format
Asynchronous
9600, N, 8, 1
Inverted polarity
Raw data
Asynchronous
19200, N, 8, 1
Inverted polarity
Raw data
Related
Commands
None SEROUT and DEBUGIN
Explanation
DEBUG provides a convenient way for your BASIC Stamp to send
messages to the
PC screen while running. The name “debug” suggests its
most popular use; debugging programs by showing you the value of a
variable or expression, or by indicating what portion of a program is
currently executing. DEBUG is also a great way to rehearse programming
techniques. Throughout this manual, we use DEBUG to give you
immediate feedback on the effects of instructions. The following example
demonstrates using the DEBUG command to send the text string message
“Hello World!”.
DEBUG "Hello, World!"
After you download this one-line program, the BASIC Stamp Editor will
open a Debug Terminal on your PC screen and wait for a response from
NOTE: Expressions are not allowed as
arguments on the BS1. The only
constant allowed for the BS1 DEBUG
command is a text string.
1
1
A
ll
2