# Where can I find information about how to implement IIR filters on micro-controllers?

I am trying to implement an IIR filter on a LPC1769 (I don't know if it's relevant). I already have the H(z) so all the design part is prety much solved. What I am looking for is information about:

• How to select an appropiate word lenght for the coefficients, acummulator, etc.
• How to select the most appropiate structure (parallel,cascade, direct forms, indirect forms....) (or some guidance at least)
• Some understanding on how to avoid overflow (scalling the coefficients or signal)
• A deeper explanation of the fdatool parameters than the one given in real-time digital signal processing.
• etc....

I've been using the fdatool of matlab to play around with the quatization of the filter. But I don't know the implications of these or what they actually mean.

I've also been reading a few chapters of this book: real-time digital signal processing : implementations and applications sen m. kuo, but I am looking for more detail in these implementation aspects. So could you tell me of some book, application note, paper or whatever that explains these issues?

I am triying to implement an A-weighting filter (the transfer function is in the link). The application is mainly taking data from the adc, perform the A-weighting and taking the RMS value of this signal.

• what's your application ? – Fat32 Jul 9 at 0:27
• I've added it, thanks! – Gaston Jul 9 at 0:41
• Take a look at this section of the ARM Cortex M3 instruction set: 34.2.6.2 UMULL, UMLAL, SMULL, and SMLAL on page 706 and 34.2.3.4 Shift Operations on page 664. You will use those instructions a lot. with 32-bit operand words and a 64-bit accumulator, you will have no problem with lack of precision. either left-justify your signals or make sure the sign bit is extended to the left. remember what scaling you apply to coefficients because your result will be too large by that factor. if you line things up right, your result will simply be in the most-significant word. – robert bristow-johnson Jul 9 at 4:05
• in fixed point, you want to use the Direct Form 1 and an accumulator that is double wide. you're gonna have a lotta fun doing high-quality fixed-point DSP with this. 32-bit words (and a 64-bit accumulator) are plenty wide. just be careful about scaling and overflow. – robert bristow-johnson Jul 9 at 4:06
• is your LPC1769 doing other tasks besides this A-weighted audio meter? i think you're gonna have MIPS to burn!!! but maybe there are other tasks that you will have to share with. are you doing this in the ARM assembly language? with C, you do not have a natural 32 bit x 32 bit going into a 64 bit result. with C it's more wasteful. also, if you're doing dB, you need a good $\log_2(\cdot)$ function. i posted some good polynomial approximations here somewhere. – robert bristow-johnson Jul 9 at 4:15