07.08.2013 Views

Turbo PMAC Users Manual Manual

Turbo PMAC Users Manual Manual

Turbo PMAC Users Manual Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Delta Tau <strong>Turbo</strong> <strong>PMAC</strong> User <strong>Manual</strong><br />

;***************************************************************<br />

; This program is a user written servo<br />

; that replicates the <strong>PMAC</strong> PID loop.<br />

; It uses the following equations defined<br />

; in the <strong>PMAC</strong> <strong>Users</strong> <strong>Manual</strong> but modified for <strong>PMAC</strong> passed terms:<br />

; K16 = 2**-16<br />

; K128 = 1/128<br />

; K23 = 2**-23<br />

; FE = DPOS - APOS - From <strong>PMAC</strong> in Ix08 * 32 counts<br />

; AVEL, DVEL - From <strong>PMAC</strong> in Ix09 * 32 counts/servo period<br />

; IPOS = ITOF(Ix33) * FE * K23 + IPOS<br />

; DACEL = DVEL - PDVEL<br />

; PDVEL = DVEL<br />

; DACOUT = ITOF(Ix30)*K16 * ( FE + K128 *(ITOF(Ix32) * DVEL +<br />

; ITOF(Ix35) * DACEL - ITOF(Ix31) *AVEL) + IPOS)<br />

#define K16 0.000015259 ; Constant of 2^-16<br />

#define K128 0.0078125 ; Constant of 1/128<br />

#define K23 0.000000119 ; Constant of 2^-23<br />

; Use L-variables<br />

for quick access to PID I-variable registers<br />

#define Ix08 L1<br />

L1->Y:(R1-$27)<br />

#define Ix09 L2<br />

L2->Y:(R1-$14)<br />

#define Ix30 L3<br />

L3->Y:(R1-$17)<br />

#define Ix31 L4<br />

L4->X:(R1-$1E)<br />

#define Ix32 L5<br />

L5->X:(R1-$21)<br />

#define Ix33 L6<br />

L6->X:(R1-$11)<br />

#define Ix35 L7<br />

L7->Y:(R1-$1D)<br />

#define Ix63 L8<br />

L8->Y:(R1-$11)<br />

#define Ix69 L9 ; Note that this is 24-bit value, not 16<br />

L9->Y:(R1-2)<br />

#define STATUS L10<br />

L10->X:(R1+0)<br />

#define IPOS F1 ; Integrated position error register<br />

F1->L:(R1-$12) ; Automatically zeroed on motor open loop<br />

#define PDVEL F2 ; Previous desired velocity register<br />

F2->L:(R1-$29) ; Automatically zeroed on motor open loop<br />

#define AVEL P0 ; Floating-point actual velocity<br />

#define DVEL P1 ; Floating-point net desired velocity<br />

#define FE P2 ; Floating-point following error<br />

#define APOS P3 ; Floating-point actual position<br />

#define DPOS P4 ; Floating-point net desired position<br />

#define DACOUT P5 ; Floating-point commanded output<br />

OPEN SERVO CLEAR<br />

COPYREG P0 ; Copy Motor AVEL,DVEL,FE,APOS,DPOS to float P0..4<br />

; FE, APOS, & DPOS in 1 / [Ix08* 32] counts<br />

; AVEL in 1 / [Ix09*32] counts/servo period<br />

Setting Up the Servo Loop 8-35

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!