Galil DMC-13X8 Home Theater Server User Manual


 
USER MANUAL Chapter 7 Application Programming 111
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.
#TASK1 Task1 label
AT0 Initialize reference time
CB1 Clear Output 1
#LOOP1 Loop1 label
AT 10 Wait 10 msec from reference time
SB1 Set Output 1
AT -40 Wait 40 msec from reference time, then initialize reference
CB1 Clear Output 1
JP #LOOP1 Repeat Loop1
#TASK2 Task2 label
XQ #TASK1,1 Execute Task1
#LOOP2 Loop2 label
PR 1000 Define relative distance
BGX Begin motion
AMX After motion done
WT 10 Wait 10 msec
JP #LOOP2,@IN[2]=1 Repeat motion unless Input 2 is low
HX Halt all tasks
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 DMC-13X8 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.