Galil DMC-3425 Home Security System User Manual


 
112 • Chapter 7 Application Programming DMC-3425
The main thread differs from the others in the following ways:
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:
XQ #A, n
Where n indicates the thread number. To halt the execution of any thread, use the instruction
HX n
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.
Instruction
Interpretation
#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, then initialize reference
CB1 Clear Output 1
JP #LOOP1 Repeat Loop1
#TASK0 Task2 label
XQ #TASK1,1 Execute Task1
#LOOP2 Loop2 label
PR 1000 Define relative distance
BGA Begin motion
AMA After motion done
WT 10 Wait 10 msec
JP #LOOP2,@IN[2]=1 Repeat motion unless Input 2 is low
HX Halt all tasks
EN End of Program
The program above is executed with the instruction XQ #TASK0,0 which designates TASK0 as the
main thread (i.e. Thread 0). #TASK1 is executed within TASK0.
Debugging Programs
The DMC-3425 provides commands and operands that 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 that can help to debug a program. Breakpoint and single stepping
commands are available to actively debug a program while in operation.