P
ar
t
2: C
omman
d
s
Moog Animatics SmartMotor™ Developer's Guide, Rev. L
Page 636 of 909
EXAMPLE:
(Shows the use of PC, PRA and PRC)
'NOTE: This example requires an external encoder.
EIGN
(
W
,0,12)
ZS
'Disable overtravel limits and clear errors
O
(0)=0
O
(1)=0
O
(2)=0
'Zero PC(0),PC(1) and PC(2)
MF0 MFDIV
=1
MFMUL
=1
'Reset CTR(1) Divisor=1 Multiplier=1
MFR
'Calculate Ratio... 1 count in equals 1 count out
MP
(1)
'Mode Position in trajectory 1 while keeping Mode Follow active
PRT
=0
G
(2)
'Set PRT=0 and start following with phase adjust active
("Adjust external encoder to ~1000 counts.",#13)
("Then type GOSUB10",#13)
END
C10
x=
CTR
(1)
("The external encoder CTR(1)=",x,#13)
x=
PC
(0)
("PC(0)=",x,#13)
x=
PC
(1)
("PC(1)=",x,#13)
x=
PC
(2) PRINT("PC(2)=",x,#13)
("PRA=",
PRA
,#13)
'PRA will be zero because PRT=0
("PRC=",
PRC
,#13)
'PRC will be zero because PRT=0
'Set relative distance, velocity target, and Accel/Decel values
PRT
=2000
VT
=5000
ADT
=100
G
(1)
TWAIT
(1)
'Start Position Relative phase adjust
("After relative move, the values are...",#13)
x=
CTR
(1)
("The external encoder CTR(1)=",x,#13)
x=
PC
(0) PRINT("
PC
(0)=",x,#13)
x=
PC
(1) PRINT("
PC
(1)=",x,#13)
x=
PC
(2) PRINT("
PC
(2)=",x,#13)
("PRA=",
PRA
,#13)
'PRA=PRC-PositionError; note default PID tuning values
("PRC=",
PRC
,#13)
'PRC=2000 because PRT=2000
("Position Error=",
EA
,#13)
RETURN
Program output is:
RUN
Adjust external encoder to ~1000 counts.
Then type GOSUB10
GOSUB10
The external encoder CTR(1)=1000
PC(0)=1000
PC(1)=0
PC(2)=1000
PRA=0
PRC=0
After relative move, the values are...
The external encoder CTR(1)=1000
PC(0)=3000
PC(1)=2000
PC(2)=1000
PRA=1991
PRC=2000
Position Error=9
Part 2: Commands: PRC
Содержание SmartMotor
Страница 1: ...Developer s Guide Class 5 Later SmartMotor Technology with TM ...
Страница 909: ...PN SC80100003 002 Rev L ...