![Galil Motion Control DMC-1600 Series User Manual Download Page 147](http://html1.mh-extra.com/html/galil-motion-control/dmc-1600-series/dmc-1600-series_user-manual_3256992147.webp)
VAR="CAT"
Assign the string, CAT, to VAR
Assigning Variable Values to Controller Parameters
Variable values may be assigned to controller parameters such as SP or PR.
PR V1
Assign V1 to PR command
SP VS*2000
Assign VS*2000 to SP command
Displaying the Value of Variables at the Terminal
Variables may be sent to the screen using the format, variable =. For example, V1= , returns the
value of the variable V1.
Example - Using Variables for Joystick Control
The example below reads the voltage of an X-Y joystick and assigns it to variables VX and VY to
drive the motors at proportional velocities, where
10 Volts = 3000 rpm = 200000 c/sec
Speed/Analog input = 200000/10 = 20000
#JOYSTIK Label
JG 0,0
Set in Jog mode
BGXY Begin
Motion
#LOOP Loop
VX=@AN[1]*20000 Read
joystick
X
VY=@AN[2]*20000 Read
joystick
Y
JG VX,VY
Jog at variable VX,VY
JP#LOOP Repeat
EN End
Operands
Operands allow motion or status parameters of the DMC-1600 to be incorporated into
programmable variables and expressions. Most DMC-1600 commands have an equivalent
operand - which are designated by adding an underscore (_) prior to the DMC-1600 command.
The command reference indicates which commands have an associated operand.
Status commands such as Tell Position return actual values, whereas action commands such as KP
or SP return the values in the DMC-1600 registers. The axis designation is required following the
command.
Examples of Internal Variables:
POSX=_TPX
Assigns value from Tell Position X to the variable POSX.
VAR1=_KPX*2
Assigns value from KPX multiplied by two to variable, VAR1.
JP #LOOP,_TEX>5
Jump to #LOOP if the position error of X is greater than 5
JP #ERROR,_TC=1
Jump to #ERROR if the error code equals 1.
Operands can be used in an expression and assigned to a programmable variable, but they cannot
be assigned a value. For example: _KPX=2 is invalid.
DMC-1600
Chapter 7 Application Programming
•
139