Galil DMC-1800 Manual De Usuario
156 • Chapter 7 Application Programming DMC-1700/1800
(+/-2,147,483,647.9999).
Numeric values can be assigned to programmable variables using the equal sign.
Any valid DMC-1700/1800 function can be used to assign a value to a variable. For example, V1=@ABS[V2] or
Numeric values can be assigned to programmable variables using the equal sign.
Any valid DMC-1700/1800 function can be used to assign a value to a variable. For example, V1=@ABS[V2] or
V2=@IN[1]. Arithmetic operations are also permitted.
To assign a string value, the string must be in quotations. String variables can contain up to six characters which
must be in quotation.
Examples:
POSX=_TPX
Assigns returned value from TPX command to variable POSX.
SPEED=5.75 Assigns
value
5.75 to variable SPEED
INPUT=@IN[2] Assigns
logical
value of input 2 to variable INPUT
V2=V1+V3*V4
Assigns the value of V1 plus V3 times V4 to the variable V2.
VAR=”CAT”
Assign the string, CAT, to VAR
Assigning Variable Values to Controller Parameters
Variable values may be assigned to controller parameters such as GN 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.
variable V1.
Example - Using Variables for Joystick
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
at proportional velocities, where
10 Volts = 3000 rpm = 200000 c/sec
Speed/Analog input = 200000/10 = 20000
#JOYSTIK Label
JG 0,0
JG 0,0
Set in Jog mode
BGXY Begin
Motion
#LOOP Loop
VX=@AN[1]*20000 Read
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
EN End
Operands
Operands allow motion or status parameters of the
DMC-1700/1800 to be incorporated into
programmable variables and expressions. Most DMC commands have an equivalent operand - which are designated
by adding an underscore (_) prior to the DMC-1700/1800 command. The command reference indicates which
commands have an associated operand.
by adding an underscore (_) prior to the DMC-1700/1800 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-1700 or DMC-1800 registers. The axis designation is required following the command.
values in the DMC-1700 or DMC-1800 registers. The axis designation is required following the command.