Control Velocity with an Analog Input
A program may follow an analog input, but this only allows the user to control position with an analog input.
The program below will allow a user to control velocity via an analog input.
The Virtual Master commands are hidden in the 6000 series products and only available in the late 4.x firmware.
DEL CONTROL ;Delete the existing program.
DEF CONTROL ;Define the program.
COMEXC1 ;Continuous execution mode.
VAR1=0 ;Set VAR1 to zero.
VAR2=0 ;Set VAR2 to zero.
MC1 ;Mode Continuous.
FVMFRQ,0 ;Virtual Master (VM) Frequency.
FVMACC,80000 ;Virtual Master Accel (cnts/sec^2).
FOLMAS25 ;Axis 1 will follow Axis 2 VM.
FOLRN1 ;Following Ratio Numerator.
FOLRD1 ;Following Ratio Denominator.
FOLEN1 ;Enable Following.
GO1 ;Start the Following.
L ;Begin Loop.
VAR1=1ANI.1 ;Analog voltage into a variable.
IF(VAR1<0.1 AND VAR1>-0.1) ;Set the deadband where no motion
VAR1=0 ; will occur.
NIF ;End deadband logic.
VAR2=VAR1*8000 ;Scale the analog input.
FVMFRQ,(VAR2) ;Set the VM Frequency to the input.
LN ;End Loop.
END ;End program.
Â