88
•
Chapter 7 Application Programming
DMC-1000
Multitasking Example: Producing 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 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-1000 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.
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com