User guide
Chapter 7. Troubleshooting
239
Trace Mode
You can use the Trace mode to debug a program. The Trace mode allows you to track,
command-by-command, the entire program as it runs. The 6000 controller will display all of
the commands as they are executed. For stand-alone controller users, program tracing is also
available on the RP240 display (see page 134).
The example below demonstrates the Trace mode.
Step 1
Create a program called prog1:
DEF prog1 ; Begin definition of program prog1
A10 ; Acceleration is 10
AD10 ; Deceleration is 10
V5 ; Velocity is 5
L3 ; Loop 3 times
GOSUB prog3 ; Gosub to program #3 (prog3)
LN ; End the loop
END ; End definition of program prog1
Step 2
Create program prog3:
DEF prog3 ; Begin definition of program prog3
D50000 ; Sets the distance to 50,000
GO1 ; Initiates motion
END ; End definition of program prog3
Step 3
Enable the Trace Mode:
TRACE1 ; Enables the Trace mode
Step 4
Execute the program prog1: (each command in the program is displayed as it is executed)
EOT13,10,0 ; Set End-of-Transmission characters to <cr>,<lf>
RUN prog1 ; Run program prog1
The response will be:
*PROGRAM=PROG1 COMMAND=A10.0000
*PROGRAM=PROG1 COMMAND=AD10.0000
*PROGRAM=PROG1 COMMAND=V5.0000
*PROGRAM=PROG1 COMMAND=L3
*PROGRAM=PROG1 COMMAND=GOSUB PROG3 LOOP COUNT=1
*PROGRAM=PROG3 COMMAND=D50000 LOOP COUNT=1
*PROGRAM=PROG3 COMMAND=GO1 LOOP COUNT=1
*PROGRAM=PROG3 COMMAND=END LOOP COUNT=1
*PROGRAM=PROG1 COMMAND=LN LOOP COUNT=1
*PROGRAM=PROG1 COMMAND=GOSUB PROG3 LOOP COUNT=2
*PROGRAM=PROG3 COMMAND=D50000 LOOP COUNT=2
*PROGRAM=PROG3 COMMAND=GO1 LOOP COUNT=2
*PROGRAM=PROG3 COMMAND=END LOOP COUNT=2
*PROGRAM=PROG1 COMMAND=LN LOOP COUNT=2
*PROGRAM=PROG1 COMMAND=GOSUB PROG3 LOOP COUNT=3
*PROGRAM=PROG3 COMMAND=D50000 LOOP COUNT=3
*PROGRAM=PROG3 COMMAND=GO1 LOOP COUNT=3
*PROGRAM=PROG3 COMMAND=END LOOP COUNT=3
*PROGRAM=PROG1 COMMAND=LN LOOP COUNT=3
*PROGRAM=PROG1 COMMAND=END
The format for the Trace mode display is:
Program Name ... Command ... Loop Count or
Program Name ... Command ... Repeat Count or
Program Name ... Command ... While Count
Step 5
Exit the Trace Mode.
TRACE0 ; Disables the Trace mode










