Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 483 of 909
EXAMPLE: (Routine maintains velocity during analog drift)
EIGN(W,0) 'Disable hardware limits
KP=3020 'Increase stiffness from default
KD=10010 'Increase damping from default
F 'Activate new tuning parameters
ADT=100 'Set maximum accel/decel
MV 'Set to Velocity mode
d=10 'Analog dead band, 5000 = full scale
o=2500 'Offset to allow negative swings
m=40 'Multiplier for speed
w=10 'Time delay between reads
b=0 'Seed b
C10 'Label to create infinite loop
a=INA(V1,3)-o 'Take analog 5 Volt full-scale reading
x=a-b 'Set x to determine change in input
IF x>d 'Check if change beyond dead band
VT=b*m 'Multiplier for appropriate speed
G 'Initiate new velocity
ELSEIF x<-d 'Check if change beyond dead band
VT=b*m 'Multiplier for appropriate speed
G 'Initiate new velocity
ENDIF 'End IF statement
b=a 'Update b for prevention of hunting
WAIT=w 'Pause before next read
GOTO10 'Loop back to label
END 'Required END (never reached)
RELATED COMMANDS:
R
IN(...) Specified Input (see page 478)
R
OC(...) Output Condition (see page 599)
R
OF(...) Output Fault (see page 603)
Part 2: Commands: INA(...)