MOTION PROGRAMMING
TECHNICAL REFERENCE
DATA INPUT
& OUTPUT, MULTITASKING
Complex applications often require several independent
tasks be executed at the same time. The DMC allows simul-
taneous execution of up to eight independent application
programs. This is an ideal feature for executing independent
operations or PLC tasks in the background.
Each separate task is defined as task 0 through 7. Any
task can be executed or halted from another task. For exam-
ple: XQ#POS1,0 begins Task 0; HX0 halts Task 0. All
DMC commands, including event triggers and conditionals,
can be used in each task. However, input interrupts and
input prompts are available only in Task 0.
Many applications require data to be input from an oper-
ator or controller messages to be displayed. For easy oper-
ator interface, the DMC has commands that display mes-
sages and prompt the operator for data.
Sending a message.
Messages can be sent to the host computer using the
message command MG.
MG "The final value is", RESULT {F5.2} sends the
message "The final value is 00000.00" to the host com-
puter. The value for the variable RESULT is displayed
with a format of 5 digits to the left of the decimal and 2
to the right.
Prompt for data.
Operators are prompted to input data with the input
statement IN which contains a text message.
IN "Input speed",SPX
The above statement sends the prompt "Input speed"
to the PC screen. The entered value is assigned to the
variable SPX.
DATA INPUT
& OUTPUT
MULTITASKING
This program prompts the operator for the cut length. A
position move is then commanded. The encoder resolution
is 4000 counts/inch.
INSTRUCTION
INTERPRETATION
#BEGIN
Label
AC 800000
Specify acceleration
DC 800000
Specify deceleration
SP 5000
Specify speed
LENGTH = 3.4
Initial length in inches
#CUT
Cut routine
IN "Enter length", LENGTH Prompt to enter length
PR LENGTH*4000
Specify position in counts
BG X
Begin motion
AM X
After motion complete
SB1
Set bit 1, turn on cutter
WT 100;CB1
Wait 100 msec, turn off cutter
JP #CUT
Repeat cut process
EN
End program
Example--Data Input & Output
The example below shows how four independent programs
can be executed simultaneously from the DMC memory.
The main task #MAIN starts all the other tasks, #PLC1,
#PLC2, #MOVE, after Input 1 goes high. It halts all tasks
when Input 1 goes low. #PLC1 sets Output 2 only when
Input 2 and Input 3 are high. #PLC2 generates a waveform
on Output 1 which is high for 10 msec and low for 40 msec.
#MOVE repetitively moves the X axis 100 counts.
INSTRUCTION
INTERPRETATION
#MAIN
Main Program --Task 0
AI1
After Input 1 high
XQ#PLC1,1
Execute Task 1
XQ#PLC2,2
Execute Task 2
XQ#MOVE,3
Execute Task 3
AI-1
After Input 1 low
HX
Halt all tasks
EN
End program
#PLC1
#PCL1 -- Task 1
OB2,@IN[2]&@IN[3] Set Output 2 if Input 2 and 3 high
JP#PLC1
Loop
EN
End Task 1
#PLC2
#PLC2 -- Task 2
AT0
Set reference time
#LOOP
Loop label
SB1;AT10
Set Output 1; wait 10 msec
CB1;AT-50
Clear Output 1; at 50 msec; reset timer
JP#LOOP
Loop
EN
End Task 2
#MOVE
#MOVE -- Task 3
PR100;BGX;AMX
Move 100 counts
WT20;JP#MOVE
Wait 20 msec and repeat
EN
End Task 3
Example--Multitasking, Background PLC
www.galilmc.com
·
Galil Motion Control, Inc.
·
85