Reference Manual

Turbo PMAC/PMAC2 Software Reference
Turbo PMAC Global I-Variables 250
Active Bias Correction Setup Word: The third setup line (I-variable) of the five-line entry contains the
sine and cosine bias terms that are used in the sum-of-squares calculations. Two signed 12-bit bias terms
are combined in a 24-bit word. The sine bias-correction term is in the high 12 bits (bits 12 23); the
cosine bias-correction term is in the low 12 bits (bits 0 11). These terms match the high 12 bits from the
corresponding A/D converters. This word does not necessarily match the bias “result” term derived from
using this entry to determine a suggested bias correction, or the bias correction used in the “feedback”
table entry for the encoder or resolver.
Reserved Setup Words: The fourth and fifth setup lines of this entry type are reserved for future use, and
should be left at 0.
Result Word (Sum of Squares): When bit 0 of the second setup line is 0, the final (fifth) result word
contains the sum of squares of the biased sine and cosine measurements for the most recent servo cycle.
Result = (SineADC + SineBias)
2
+ (Cosine ADC + CosineBias)
2
The values SineADC and CosineADC are read from the A/D converters at the address specified in the first
setup line. The values SineBias and CosineBias are read from the third setup line.
To understand the scaling of the result word, it is best to think of all four of the values as being
normalized, that is, having a valid range of -1.0 to +1.0. With small bias terms, the sum of squares result
would have a possible normalized value of 0.0 to +2.0. When read as an unsigned integer, this register
has a range of 0 to 16,777,215 ($FFFFFFF), corresponding to a normalized range of 0.0 to 2.0.
When the encoder and interpolator circuitry, or the resolver and excitation circuitry, are working properly,
the sum of squares should have a normalized value of +0.25 to +0.9999 (2,097,152 to 8,388,607, or
$200000 to $7FFFFF). If the resulting normalized value is greater than or equal to +1.0 (8,388,608, or
$800000), meaning that the most significant bit (bit 23) is set to 1, at any point in the cycle, this indicates
that saturation has occurred in at least one of the readings due to either too large a signal or a significant
bias. This should be corrected before using this sensor in actual operation.
If the result has a normalized value of less than +0.25 (2,097,152, or $200000), meaning that bits 23, 22,
and 21 are all 0, at low sensor frequencies, the signals are too small to get full resolution from the result,
and this should be corrected before using this sensor in actual operation. Many sinusoidal encoders do
have a reduction in signal magnitude of up to one-half at their highest frequencies, reducing the
magnitude of this square term by three-quarters, and this is acceptable.
It is possible to monitor this term in the actual application to check for loss of the encoder. If the inputs
are no longer driven externally, for example because the cable has come undone, the positive and negative
input pair to the ADC will pull to substantially the same voltage, and the output of the ADC will be a very
small number, resulting in a small magnitude of the sum of squares in at least part of the cycle. (If both
signals cease to be driven externally, the sum of squares will be small over the entire cycle). The high
four bits (bits 20 23) of the sum-of-squares result can be monitored, and if the four-bit value goes to 0, it
can be concluded that the encoder has been “lost”, and the motor should be “killed”.
Ideally, the magnitude of the sum-of-squares result should be constant throughout the sine/cosine cycle, at
least at constant frequency. If there is significant variation, this is an indication of signal imperfection. In
most cases, the most important imperfection is a DC bias on the sine and/or cosine signals. This entry can
be used in its alternate format to determine the optimal bias correction. Once that bias correction has
been determined (the result word in that format), it can be copied into the active correction setup word for
the diagnostic entry, and the entry put back into sum-of-squares mode, as an important verification that a
good bias correction has been determined.
A/D Bias Result Word: When bit 0 of the second setup line is 1, the final (fifth) result word contains the
suggested bias correction word containing the bias correction terms for the sine and cosine terms. This
24-bit value, containing two signed 12-bit correction terms, can be copied into the third setup word for the