Debugging Programs - Galil Motion Control DMC-1600 Series User Manual

Table of Contents

Advertisement

#TASK2
XQ #TASK1,1
#LOOP2
PR 1000
BGX
AMX
WT 10
JP #LOOP2,@IN[2]=1
HX
The program above is executed with the instruction XQ #TASK2,0 which designates TASK2 as
the main thread (i.e. Thread 0). #TASK1 is executed within TASK2.

Debugging Programs

The DMC-1600 provides commands and operands which are useful in debugging application
programs. These commands include interrogation commands to monitor program execution,
determine the state of the controller and the contents of the controllers program, array, and
variable space. Operands also contain important status information which can help to debug a
program.
Trace Commands
The trace command causes the controller to send each line in a program to the host computer
immediately prior to execution. Tracing is enabled with the command, TR1. TR0 turns the trace
function off. Note: When the trace function is enabled, the line numbers as well as the command
line will be displayed as each command line is executed.
Data which is output from the controller is stored in an output FIFO buffer. The output FIFO
buffer can store up to 512 characters of information. In normal operation, the controller places
output into the FIFO buffer. The software on the host computer monitors this buffer and reads
information as needed. When the trace mode is enabled, the controller will send information to
the FIFO buffer at a very high rate. In general, the FIFO will become full since the software is
unable to read the information fast enough. When the FIFO becomes full, program execution will
be delayed until it is cleared. If the user wants to avoid this delay, the command CW,1 can be
given. This command causes the controller to throw away the data which can not be placed into
the FIFO. In this case, the controller does not delay program execution.
Break and Single Step Commands
The commands BK and SL can be used to single step through an application program. See the
command reference for details.
Error Code Command
When there is a program error, the DMC-1600 halts the program execution at the point where the
error occurs. To display the last line number of program execution, issue the command, MG _ED.
The user can obtain information about the type of error condition that occurred by using the
command, TC1. This command reports back a number and a text message which describes the
error condition. The command, TC0 or TC, will return the error code without the text message.
For more information about the command, TC, see the Command Reference.
DMC-1600
Task2 label
Execute Task1
Loop2 label
Define relative distance
Begin motion
After motion done
Wait 10 msec
Repeat motion unless Input 2 is low
Halt all tasks
Chapter 7 Application Programming • 121

Advertisement

Table of Contents
loading

Table of Contents