Reference Manual

Turbo PMAC/PMAC2 Software Reference
Turbo PMAC Global I-Variables 243
Low-Pass Filter Entries ($D): The $D entry is used to create one of two types of low-pass filters on a
word of input data to provide smoothing of noisy measurements. The two types of filter are distinguished
by bit 19 of the first setup line of the entry. If the bit-19 mode-switch bit is 0, typically making the
second hex digit $0, the filter is a simple exponential filter. If the bit-19 mode-switch bit is 1, typically
making the second hex digit $8, the filter is a more sophisticated tracking filter that includes an integrator
to eliminate steady-state errors.
The simpler exponential filter, which is a three-line entry in the table, is suitable for the smoothing of
noisy master data used for electronic gearing (position following) or electronic cams (external time base).
However, it will produce lags even in the steady state (e.g. at constant velocity), so it is usually not
suitable for smoothing servo feedback data because of the delays it introduces.
The more complex tracking filter, which is a five-line entry in the table, is suitable for smoothing either
master data or feedback data, because its integrator eliminates steady-state errors. Still, its filtering can
introduce delays in responding to dynamic changes (e.g. accelerations), so it needs to be set up carefully.
This software tracking filter is dynamically equivalent to the hardware tracking filters common in
resolver-to-digital converter ICs. It is commonly used to smooth the results of direct conversion of
sinusoidal encoders.
Warning: Attempting to enter a tracking filter into a Turbo PMAC with firmware that does not support it
(V1.940 or older) will result in disturbing or disabling any subsequent entries in the table as well as the
filter entry.
Exponential Filter ($Dxxxxx, bit 19 = 0)
The equation of the exponential filter executed every servo cycle n is:
If [In(n) - In(n-1)] > Max_change, In(n) = In(n-1) + Max_change
If [In(n) - In(n-1)] < -Max_change, In(n) = In(n-1) - Max_change
Out(n) = Out(n-1) + (K/2
23
)*[In(n)-Out(n-1)]
In, Out, and K are all signed 24-bit numbers (range -8,388,608 to 8,388,607). The difference [In(n)-
Out(n-1)] is truncated to 24 bits to handle rollover properly.
The time constant of the filter, in servo cycles, is (2
23
/K)-1. The lower the value of K, the longer the time
constant.
No shifting action is performed. Any operations such as 1/T interpolation should have been done on the
data already, so the source register for this filter is typically the result register of the previous operation in
the conversion table.
Method/Address Word: The first setup line (I-variable) of an exponential filter entry contains a ‘D’ in the
first hex digit (bits 20 23), a ‘0’ in bit 19, and the address of the source X-register in bits 0 18. If it is
desired to execute an exponential filter on the contents of a Y-register, the contents of the Y-register must
first be copied to an X-register in the conversion table with a “parallel” entry ($2) higher in the table. The
source addresses for exponential filter entries are almost always from the conversion table itself
(X:$003501 X:$0035BC). Since bits 16 18 of conversion table registers are 0, this makes the entire
second hex digit of this line ‘0’. For example, to perform an exponential filter on the result of the fourth
line of the table, the first setup line of the filter entry would be $D03504.
Maximum Change Word: The second setup line (I-variable) of an exponential filter entry contains the
value “max change” that limits how much the entry can change in one servo cycle. The units of this entry
are whatever the units of the input register are, typically 1/32 of a count. For example, to limit the change