Debugging Programs; Trace Command - Galil Motion Control CDS-3310 User Manual

Table of Contents

Advertisement

1. Only the main thread, thread 0, may use the input command, IN.
2. When automatic subroutines are implemented for limit switches, position errors or command errors,
they are executed in thread 0.
To begin execution of the various programs, use the following instruction:
Where n indicates the thread number. To halt the execution of any thread, use the instruction
where n is the thread number.
Note that both the XQ and HX commands can be performed by an executing program.
The example below produces a waveform on Output 1 independent of a move.
The program above is executed with the instruction XQ #TASK2,0 which designates TASK2 as the
main thread (ie. Thread 0). #TASK1 is executed within TASK2.

Debugging Programs

The CDS-3310 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 Command

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.
20 • Chapter 7 Application Programming
XQ #A, n
HX n
Instruction
#TASK1
AT0
CB1
#LOOP1
AT 10
SB1
AT -40
CB1
JP #LOOP1
#TASK2
XQ #TASK1,1
#LOOP2
PR 1000
BGX
AMX
WT 10
JP #LOOP2,@IN[2]=1
HX
Interpretation
Task1 label
Initialize reference time
Clear Output 1
Loop1 label
Wait 10 msec from reference time
Set Output 1
Wait 40 msec from reference, then initialize reference
Clear Output 1
Repeat Loop1
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
CDS-3310

Advertisement

Table of Contents
loading

Table of Contents