How to use DEBUG to trouble-shoot serial communications
Technote 109
Date: 11/95
Product: SmartCAM Communicate
Version: Up to v8.2
This Technote shows an example of how to use the DEBUG utility to find out what you are getting
for End-of-Block characters in Communicate:
1. Here is a sample code file:
C:\SM8>type codefile
N9000
N1 G17
N2 G54
N3 T1 M06
N4 S374 M03
N5 G00 X0.0 Y5.0
2. Here is a Debug script named "run" that will show the first portion of the code
file. You can create this script in Edit Plus. Be sure to have one blank line after the 'q'.
d
q
3. Here is the command line to run the Debug script. This will scan the initial portion of your
code file, then echo the results to your screen:
C:\SM8>debug codefile < run
The output appears as follows:
-d
14AF:0100 4E 39 30 30 30 0D 0A 4E-31 20 47 31 37 0D 0A 4E N9000..N1 G17..N
14AF:0110 32 20 47 35 34 0D 0A 4E-33 20 54 31 20 4D 30 36 2 G54..N3 T1 M06
14AF:0120 0D 0A 4E 34 20 53 33 37-34 20 4D 30 33 0D 0A 4E ..N4 S374 M03..N
14AF:0130 35 20 47 30 30 20 58 30-2E 30 20 59 35 2E 30 0D 5 G00 X0.0 Y5.0.
14AF:0140 0A B0 DD E9 28 FE 80 3E-87 26 00 74 3F 80 3E 8F ....(..>.&.t?.>.
14AF:0150 20 00 75 38 83 3E 8B 20-5C 74 31 80 3E 80 26 00 .u8.>. \t1.>.&.
14AF:0160 75 2A 80 3E 09 26 00 75-23 FF 36 8B 20 E8 B4 FC u*.>.&.u#.6. ...
14AF:0170 0B C0 75 03 E9 F7 FD 83-3E 8B 20 28 75 0E FF 36 ..u.....>. (u..6
-q
The above information is divided into three groupings:
- Memory addresses (left grouping in the form segment:offset) (IGNORE THIS)
- HEX values (middle grouping - 16 columns of two-digit HEX numbers)
- ASCII characters (right grouping - 16 columns of the ASCII characters or markers)
Specific information about Debug output is below:
- Each two-digit HEX value corresponds to each single-digit ASCII value)
- In the ASCII grouping, Debug shows periods for control characters (anything from "00"
to "31" hex). It also shows a period for periods, which are "2E" in hex.
- The ASCII right-most grouping is a "stream", so NC code blocks may wrap among multiple
lines. You want to scan for two periods that are between each NC code block. Normally these two periods
are "OD" and "OA".
- "0D" in HEX is a CARRIAGE RETURN (^M). "0A" in HEX is a LINE FEED (^J).
- For DOS/Windows you need "0D 0A" as End of Block so text editors can properly read in the
file and separate the lines.
- If you have something different here (for example "0D 0A 0A", "0A 0D",
just "0D", just "0A", or something else) then put whatever you see here in
Communicate's End-of-Block field.
To do this, select Edit Settings command button, then select Comm command button, then edit the
End of Block input field (e.g., Change ^M^J to whatever you are getting).
- Use the Carat character '^' followed by a letter (for help, look in Communicate: Accessories -
ASCII Table...).
- Again, "0D 0A" are ^M^J. Note that in Debug the HEX values are separated by spaces,
don't include spaces in Communicate.
- Alternatively in Communicate you can use the "\NNN" decimal format for control characters.
For example NUL is "\000", CR is "\013", and LF is "\010".
- This technote uses a very small sample code file, so the 'd' command shows more information than
is actually contained in the codefile. Don't worry, the extra information is just left-over stuff in
memory.
There is a way to check the length of a file if needed, but usually the problem with control
characters occurs in the first few lines anyway, so this method should to work.
- If you see additional Control Characters within your NC code file, these may need to be filtered
out during receive transmissions. To do this, use the Translation Table in Communicate. Enter the
value of the Control Character in the FROM Field. Leave the TO Field blank (no spaces or anything).
Next time you receive the file, this character should be gone.
- You may of course use a different HEX file viewer/editor. Refer to the instructions included with
that utility for usage.