Example, Example - using variables for joystick – Yaskawa SMC–4000 User Manual

Page 334

Advertising
background image

324

SMC–4000 User 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

SP VS*2000

Assign VS*2000 to SP 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

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

Advertising