Delta Tau GEO BRICK LV User Manual

Page of 440
 
Turbo PMAC User Manual 
180
 
Motor Compensation Tables and Constants 
; FE, APOS, & DPOS in 1 / [Ix08* 32] counts 
; AVEL in 1 / [Ix09*32] counts/servo period 
; DVEL in 1 / [Ix08*32] counts/servo period; 
;  if( Ix34 = 1 && Des_Vel0 = 1 OR Ix34 = 0) 
;  then integrate IPOS = IPOS + FE * Ix33 && Limit to Ix63 
If (STATUS&$12000 = $12000 Or STATUS&$10000 = 0) ; Test Ix34 mode 
  IPOS = FLIMIT(ITOF(Ix33)*FE*K23+IPOS, ITOF(Ix63)*ITOF(Ix08)*2)   
  ; Scale Ix63 to include Ix08 
EndIf 
DACOUT = FLIMIT(ITOF(Ix30)*K16 * ( FE + K128 *(ITOF(Ix32) * DVEL + ITOF(Ix35) 
* (DVEL - PDVEL) - ITOF(Ix31) *AVEL) + IPOS), ITOF(Ix69))  
PDVEL =DVEL  
; Store for next cycle 
RETURN(FTOI(DACOUT)) 
CLOSE 
Downloading the Program 
Each time the Executive program’s downloader sends the compiled code for an Open Servo algorithm to 
the Turbo PMAC, it first completely erases the existing user-written servo code in the Turbo PMAC.  
Therefore, always re-compile the entire Open Servo, even for the slightest change.  The CLEAR command 
used at the start of these examples is not therefore needed, but it can be included for consistency of style 
with interpreted programs. 
Remember that the download process only puts the Open Servo algorithm into the volatile active RAM 
memory.  To keep this algorithm loaded in the Turbo PMAC through a reset or power-cycling, copy it to 
non-volatile flash memory with the SAVE command first. 
Executing the Open Servo Program 
For the Open Servo algorithm to execute for a given motor, Ixx00 for the motor must be equal to 1 so that 
motor calculations are activated.  Bit 0 of Ixx59 must be set to 1 (Ixx59 = 1 or 3) so it will choose the 
user-written servo algorithm generated from the Open Servo instead of a built-in servo algorithm (PID or 
ESA).  Finally, the servo loop must be closed for this motor.  The Open Servo algorithm will not executed 
if the motor is either in the open-loop enabled state, or the killed (open-loop disabled) state. 
The Open Servo algorithm obeys the Ixx60 servo-cycle extension parameter for each Motor xx.  As with 
the built-in PID and ESA servo algorithms, it executes every [Ixx60+1] servo interrupts.  With the default 
Ixx60 value of 0, it executes every servo interrupt. 
Those users who are employing the Open Servo algorithm for tasks other than actually closing servo 
loops must be careful not to disable the algorithm unintentionally.  The algorithm will not be running 
immediately on power-up/reset unless bit 0 of Ixx80 for the motor is set to 1.  A <CONTROL-K> (kill all) 
command disables the servo loops of all motors, including a pseudo-motor running an Open Servo 
algorithm.  With the default settings of bits 21 and 22 of Ixx24 an amplifier fault or fatal following-error 
fault on any motor disables the servo loops of all motors, including a pseudo-motor running an Open 
Servo algorithm. 
The Open Servo replaces only the actual servo-loop closure algorithm for the selected motors.  Other 
tasks done as part of the servo interrupt, including encoder-conversion-table processing, commanded 
trajectory generation, position following, and time-base control, are executed by the built-in firmware, 
whether or not the Open Servo is selected for any motor.  Also, related tasks done outside of the servo 
interrupt, such as checking against a fatal following error limit, are executed by the built-in firmware.