BASIC stamp manual v2.2
5: BASIC Stamp Command Reference – DEBUG
BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com • Page 169
On all the BS2 models, DEBUG is actually a special case of the SEROUT
instruction. It is set for inverted (RS-232-compatible) serial output through
the programming connector (the SOUT pin) at 9600 baud, no parity, 8 data
bits, and 1 stop bit. For example,
DEBUG "Hello"
is exactly like:
' {$STAMP BS2}
SEROUT 16, $4054, ["Hello"]
in terms of function on a BS2. The DEBUG line actually takes less
program space, and is obviously easier to type.
Another method to decrease program space is to reduce the number of
DEBUG instructions by spreading DEBUG data across multiple lines. To
do this, each line that wraps around must end with a comma as in the
example below:
' {$PBASIC 2.5}
DEBUG "This is line 1", CR,
"This is line 2"
The example above works identically to, but uses less program space than
this version:
DEBUG "This is line 1", CR
DEBUG "This is line 2"
Note that spreading a DEBUG statement across multiple lines requires the
declaration of PBASIC 2.5 syntax.
You may view DEBUG's output using a terminal program set to the above
parameters, but you may have to modify either your development board
or the serial cable to temporarily disconnect pin 3 of the BASIC Stamp (pin
4 of the DB-9 connector). See the SEROUT command for more detail.
A demo program for all BS2 models that uses DEBUG and DEBUGIN
commands can be found at the end of the DEBUGIN section, next.
TECHNICAL BACKGROUND
All
2