Speed control by joystick, Position control by joystick – Yaskawa SMC–4000 User Manual
Page 371
361
SMC–4000 User Manual
Speed Control by Joystick
The speed of a motor is controlled by a joystick. The joystick produces a signal in the range between
-10V and +10V. The objective is to drive the motor at a speed proportional to the input voltage.
Assume that a full voltage of 10 Volts must produce a motor speed of 3000 rpm with an encoder
resolution of 1000 lines or 4000 count/rev. This speed equals:
3000 rpm = 50 rev/sec = 200000 count/sec
The program reads the input voltage periodically and assigns its value to the variable VIN. To get a
speed of 200,000 ct/sec for 10 volts, we select the speed as
Speed = 20000 x VIN
The corresponding velocity for the motor is assigned to the VEL variable.
Position Control by Joystick
This system requires the position of the motor to be proportional to the joystick angle. Furthermore, the
ratio between the two positions must be programmable. For example, if the control ratio is 5:1, it implies
that when the joystick voltage is 5 Volts, corresponding to 4095 counts, the required motor position must
be 20475 counts. The variable V3 changes the position ratio.
Instruction
Function
#A
Label
JG0
Set motor in jog mode speed zero
BGX
Start motion
#B
Label
VIN=@AN[1]
Read analog input
VEL=VIN*20000
Compute the desired velocity
JG VEL
Change the jog speed
JP #B
Repeat the process
EN
End
Instruction
Function
#A
Label
V3=5
Initial position ratio
DP0
Define the starting position
JG0
Set motor in jog mode as zero
BGX
Start
#B
V1=@AN[1]
Read analog input
V2=V1*V3
Compute the desired position
V4=V2-_TPX-_TEX
Find the following error