Example, Pr v1 assign v1 to pr command, Example - using variables for joystick – Yaskawa LEGEND-MC User Manual
Page 313: 10 volts = 8191 counts --> 3000 rpm = 200000 c/sec, Speed/analog input = 200000/8191 = 24.4, Internal variables & keywords

303
LEGEND-MC User’s Manual
Example:
Variable values may be assigned to controller parameters such as GN or PR. Here, an equal is not used.
For example:
PR V1
Assign V1 to PR command
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
10 Volts = 8191 counts --> 3000 rpm = 200000 c/sec
Speed/Analog input = 200000/8191 = 24.4
Internal Variables & Keywords
Internal variables allow motion or status parameters from LEGEND-MC commands to be incorporated
into programmable variables and expressions. Internal variables are designated by adding an underscore
(_) prior to the LEGEND-MC command. LEGEND-MC commands which can be used as internal
variables are listed in the Command Reference as "Used as an Operand".
Most LEGEND-MC commands can be used as internal variables. Status commands such as Tell Position
return actual values, whereas action commands such as GN or SP return the values in the LEGEND-MC
registers. The X,Y,Z or W or A,B,C,D,E,F,G,H for the LEGEND-MC, axis designation is required
following the command.
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
#JOYSTICK
Label
JG 0,0
Set in Jog mode
BGXY
Begin Motion
#LOOP
Loop
VX=@AN[1]*24.4
Read joystick X
VY=@AN[2]*24.4
Read joystick Y
JG VX,VY
Jog at variable VX,VY
JP#LOOP
Repeat
EN
End