TECHNICAL REFERENCE
MOTION PROGRAMMING
CONTROL VARIABLES
The DMC can receive commands from both the host
computer and the stored program and execute these instruc-
tions simultaneously.
Many motion applications include variable parameters. For
example, a cut-to-length application often requires that the
cut length be variable. The motion process is the same, but
the length is changing. To accommodate these applications,
advanced controllers provide symbolic variables. A program
can be written in which certain parameters, such as position
or speed, are defined as variables. The variables can later be
assigned by the operator or determined by program calcula-
tions. Variables allow the motion controller to perform cer-
tain mathematical functions and to make decisions. This
capability increases the intelligence of the motion controller
and allows it to perform some supervisory functions in addi-
tion to the motion control.
A variable can be defined as a constant or can be
equated to a controller parameter. For example, the
instruction V = 3 sets the value of the variable V to 3.
The instruction P = _TPX reads the position of the X motor
and equates the variable P to that value. Variables can be
defined in a variety of ways. For example, the instruction
YERROR = _TEY equates the variable YERROR to the
position error of the Y motor.
Once the variable is defined, it can be used in mathe-
matical operations. The DMC can perform mathematical
functions which typically include algebraic, trigonometric,
and logical operations.
When the operation is completed, the controller can use
the computation result to adjust the system parameters. For
example, the results can be used to change the speed, set the
distance, or change the filter gain. The use of variables is
best illustrated by the following example.
To illustrate the concept, consider the move described in
the point-to-point example. To perform the same move
from a stored program, the host modifies the program
by adding the label #A and the end statement EN. The
resulting program is as follows.
The host downloads this program to the controller
memory, where the program remains inactive. To exe-
cute the program, the host sends the command XQ#A
which causes the controller to execute the program
labeled #A.
INSTRUCTION
INTERPRETATION
#A
Program label
PR 4000
Distance
SP 20000
Speed
AC 200000
Acceleration
DC 200000
Deceleration
BGX
Start X motion
EN
End of program
Example--Stored Programs
The following program shows an example where the X
motor follows the position of the Y motor. This is done
by driving the X motor at a speed proportional to the
position difference.
INSTRUCTION
INTERPRETATION
#FOLLOW
Program name
DP 0,0
Define X,Y position as zero
JG 0
Set initial X speed to zero
BGX
Start X
#LOOP
Label
VE=_TPY-_TPX
Find the position difference
VEL=VE*10
Compute the speed
JG VEL
Modify the speed
JP #LOOP
Repeat the process
EN
End of program
Example--Position Follower
CONTROL VARIABLES
82
·
Galil Motion Control, Inc.
·
www.galilmc.com