[time-nuts] PLL Math Question

Hal Murray hmurray at megapathdsl.net
Wed Mar 12 15:25:55 EDT 2014

magnus at rubidium.dyndns.org said:
> Exponential averger takes much less memory. Consider this code:
> x_avg = x_avg + (x - x_avg) * a_avg;
> Where a_avg is the time-constant control parameter. 

Also note that if a_avg is a power of 2, you can do it all with shifts rather 
than multiplies.

Note that the shift is to the right which drops bits.  That suggests that you might want to work with x scaled relative to the raw data samples.  Consider a_avg to be 1/8, or a shift right 3 bits.  Suppose x_avg is 0 and you get a string of x samples of 2.  The shift throws away the 2 so x_avg never changes.

These are my opinions.  I hate spam.

More information about the time-nuts mailing list