Galil Motion Control note 2319 Page 2
Application
Program
-
+
Force
Sensor
Plant
Amp
PID
Encoder
Motor
Here, the block labeled 'Application Program' contains the code that reads
the analog input produced from the sensor and directs the movement of the
motor to produce the desired force. Here is an example this type of
program:
#A
Program label
SETPOINT=4
Default set-point
SCALE=1000
Scale factor
JG0
Start jog mode
BGX
Begin Motion on X axis
#B
New label
ERROR = SETPOINT - @AN[1]
Subtract analog input from
desired setpoint
JOGSPEED=ERROR *SCALE
Calculate a jog speed
JG JOGSPEED
Set jog speed to 'JOGSPEED'
JP#B
Jump to the start of the loop
EN
End of Progrm
This program will close the loop about every 2.5ms. This program closes
the loop with a proportional factor only. The SCALE variable is the
equivalent to the 'KP' of the DMC controller PID filter. More complex
filters can be coded, but this normally is sufficient.