Galil DMC-2X00 用户手册

下载
页码 267
DMC-2X00 
Chapter 7 Application Programming  
y 81  
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 
#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 (i.e. Thread 0).  #TASK1 is executed within TASK2. 
Debugging Programs 
The DMC-2x00 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 ( DMC-2100/2200 only) 
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 the output UART.  The UART buffer can store up 
to 128 characters of information.  In normal operation, the controller places output into the FIFO 
buffer.  When the trace mode is enabled, the controller will send information to the UART buffer at a 
very high rate.  In general, the UART will become full because the hardware handshake line will halt 
serial data until the correct data is read.  When the UART 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.