Delta Tau GEO BRICK LV Manuel D’Utilisation
Turbo PMAC User Manual
174
Motor Compensation Tables and Constants
COPYREG Command: The COPYREG command copies five key registers for the executing motor into
five consecutive P-variables, where they can easily be used for calculations. The user does not have to
know the addresses of these registers. In doing this copying, Turbo PMAC automatically converts the
data to 48-bit floating-point format.
The syntax of this command is COPYREG {P-variable name}, where {P-variable name}
specifies the number of the first variable into which data will be copied. The five registers to be copied
by this command are:
five consecutive P-variables, where they can easily be used for calculations. The user does not have to
know the addresses of these registers. In doing this copying, Turbo PMAC automatically converts the
data to 48-bit floating-point format.
The syntax of this command is COPYREG {P-variable name}, where {P-variable name}
specifies the number of the first variable into which data will be copied. The five registers to be copied
by this command are:
•
Actual Velocity (1/[Ixx09*32] counts / [Ixx60+1] servo cycles)
•
Desired Velocity (1/[Ixx08*32] counts / [Ixx60+1] servo cycles)
•
Following Error (1/[Ixx08*32] counts)
•
Actual Position (1/[Ixx08*32] counts)
•
Desired Position (1/[Ixx08*32] counts)
The actual position value is derived from the register selected by Ixx03 for the motor (Position-Loop
Feedback Address), with the source value multiplied by the Ixx08 scale factor and extended into a 48-bit
long word. The actual velocity value is derived from the position value selected by Ixx04 for the motor
(Velocity-Loop Feedback Address), taking this cycle’s actual velocity-loop position value minus the
value at the previous loop closure and multiplying the difference by the Ixx09 scale factor. Note that this
scale factor is not necessarily the same as for the desired velocity.
For the desired position value, Turbo PMAC adds the trajectory commanded position and the master
position (from the position following, or electronic gearing function), then subtracts the compensation
position (from the position, or leadscrew compensation tables), creating a net desired position value. The
desired velocity value is simply this cycle’s desired position value minus the value at the previous loop
closure.
The following error value is the desired position the actual position. The subtraction is done using 48-bit
fixed-point values; then the difference is converted to floating-point format. There are several advantages
to using the following error value directly. First, it saves some computational time. Second, when the
commanded and actual positions get very large, it preserves fractional position data better.
If the command COPYREG P5 were used, the Actual-Velocity value would be copied into P5, Desired
Velocity into P6, Following Error into P7, Actual Position into P8, and Desired Position into P9. Note
the differing units between the actual and desired velocity registers. (The desired velocity value is not
typically used in actual servo loop closure. Turbo PMAC uses this register in the numerical integration
process to compute the desired position value each servo cycle.)
Offsets from Registers of Executing Motor: The compiler’s L-variables and F-variables can be
declared by address offset to specific registers of the executing motor. In this way, they automatically
index properly from motor to motor, permitting the same variables and code to be used for multiple
motors. These variables can be declared by offset to the motor’s R0 register, which is the motor’s
command output register ($BF for Motor 1), or by offset to the motor’s R1 register, which is the motor’s
status register ($B0 for Motor 1). L-variables can be declared to 24-bit X or Y registers this way; F-
variables can be declared to 48-bit fixed-point or floating-point registers this way. Some examples:
Feedback Address), with the source value multiplied by the Ixx08 scale factor and extended into a 48-bit
long word. The actual velocity value is derived from the position value selected by Ixx04 for the motor
(Velocity-Loop Feedback Address), taking this cycle’s actual velocity-loop position value minus the
value at the previous loop closure and multiplying the difference by the Ixx09 scale factor. Note that this
scale factor is not necessarily the same as for the desired velocity.
For the desired position value, Turbo PMAC adds the trajectory commanded position and the master
position (from the position following, or electronic gearing function), then subtracts the compensation
position (from the position, or leadscrew compensation tables), creating a net desired position value. The
desired velocity value is simply this cycle’s desired position value minus the value at the previous loop
closure.
The following error value is the desired position the actual position. The subtraction is done using 48-bit
fixed-point values; then the difference is converted to floating-point format. There are several advantages
to using the following error value directly. First, it saves some computational time. Second, when the
commanded and actual positions get very large, it preserves fractional position data better.
If the command COPYREG P5 were used, the Actual-Velocity value would be copied into P5, Desired
Velocity into P6, Following Error into P7, Actual Position into P8, and Desired Position into P9. Note
the differing units between the actual and desired velocity registers. (The desired velocity value is not
typically used in actual servo loop closure. Turbo PMAC uses this register in the numerical integration
process to compute the desired position value each servo cycle.)
Offsets from Registers of Executing Motor: The compiler’s L-variables and F-variables can be
declared by address offset to specific registers of the executing motor. In this way, they automatically
index properly from motor to motor, permitting the same variables and code to be used for multiple
motors. These variables can be declared by offset to the motor’s R0 register, which is the motor’s
command output register ($BF for Motor 1), or by offset to the motor’s R1 register, which is the motor’s
status register ($B0 for Motor 1). L-variables can be declared to 24-bit X or Y registers this way; F-
variables can be declared to 48-bit fixed-point or floating-point registers this way. Some examples:
L220->X:(R1-$27)
; Ixx08 scale factor register
L270->Y:(R1+0)
; Motor status register
F392->D:(R1-$24)
; Motor master position register
F34->L:(R0+11)
; Ixx16 maximum commanded speed
The offset must be in the range –64 <= {offset} <= 63 (-$40 <= {offset} <= $3F).
Returned Value: The RETURN command takes the integer value inside the following parentheses and
places it in a 24-bit signed integer register where Turbo PMAC’s standard firmware will take it and use it as
the servo command. Typically, the commanded value will be computed as a floating-point value, so must
be converted to an integer with the ITOF function. Typical uses of the RETURN command could be:
Returned Value: The RETURN command takes the integer value inside the following parentheses and
places it in a 24-bit signed integer register where Turbo PMAC’s standard firmware will take it and use it as
the servo command. Typically, the commanded value will be computed as a floating-point value, so must
be converted to an integer with the ITOF function. Typical uses of the RETURN command could be: