| Electronic Components Datasheet Search |
|
AN540 Datasheet(PDF) 2 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
AN540 Datasheet(HTML) 2 Page - Microchip Technology |
|
2 / 17 page ![]() DS00540B-page 2 © 1993 Microchip Technology Inc. Implementing IIR Digital Filters DSPLAY is a trademark of Burr-Brown DFDP is a trademark of Atlanta Signal Processing Inc. Windows is a trademark of Microsoft Corporation MathCad is a registered trademark of MathSoft, Inc. The structure as shown in Figure 1 may be cascaded to attain a higher order filter. For example, if two stages are cascaded together, a 4th Order IIR Filter is obtained. This way, the output of the 1st stage becomes the input to the second stage. Multiple order filters are thus implemented by cascading a 2nd order filter structure as shown in Figure 1. IMPLEMENTATION A 4th order IIR Filter is implemented by cascading two structures shown in Figure 1. The output Y (output of each filter stage) is computed by direct implementation of Equations (1) & (2). Since each stage is similar algorithmically, it is implemented as a Macro using Microchip’s Assembler/Linker for PIC17C42. This Macro (labelled “BIQUAD”) is called twice for implementing a 4th order filter. The output of the 1st stage is directly fed to the input of the second stage without any scaling. Scaling is required depending on the particular applica- tion. The user can modify the code very easily without any penalty on speed. Also, saturation arithmetic is not used. Overflows can be avoided by limiting the input sequence amplitude. All numbers are assumed to be 16 bits in Q15 format (15 decimal points, MSB is sign bit). Thus the user must scale and sign extend the input sequence accordingly. For example, if the input is from a 12-bit A/D converter, the user must sign extend the 12-bit input if bit 11 is a one. The BIQUAD macro is a generic macro and can be used for all IIR filters whether it is Low Pass, High Pass, Band Pass or Band Stop. A general purpose 16x16 multiplier routine is also provided. This routine is implemented as a straight line code for speed considerations. The 4th order IIR filter implemented is a Low Pass Filter with the specifications as shown in Table 1. BAND1 BAND2 Lower Band Edge 0.0 600 Hz Upper Band Edge 500 Hz 1 Khz Nominal Gain 1.0 0.0 Nominal Ripple 0.01 0.05 Maximum Ripple 0.00906 0.04601 Ripple in dB 0.07830 -26.75 Sampling Frequency = 2 Khz TABLE 1 - FILTER CONSTANTS The Low Pass Filter is designed using a digital filter design package (DFDP by Atlanta Signal Processors Inc.). The filter package produces filter constants of the structure shown in Table 1. Table 2 shows the filter co- efficients that are obtained for the above Low Pass filter specification. Co-efficients a1 a2 b0 b1 b2 Stage 1 -0.133331 0.167145 0.285431 0.462921 0.285431 Stage 2 0.147827 0.765900 0.698273 0.499908 0.698273 TABLE 2 - FILTER COEFFICIENTS The above filter co-efficients (5 per stage) are quantized to Q15 format (i.e they are multiplied by 32768) and saved in program memory (starting at label “_coeff_lpass”). The constants for both the stages are read into data memory using TLRD and TABLRD in- structions in the Initialization Routine (labelled “initFilter”). The user may read the coefficients of only one stage at a time and save some RAM at the expense of speed. The sample 4th order Low Pass IIR Filter is tested by analyzing the impulse response of the filter. An impulse signal is fed as input to the filter. This is simulated by forcing the input to the filter by a large quantity (say 7F00h) on the first input sample, and the all zeros from the 2nd sample onwards. The output sequence is the filter’s impulse response and is captured into the PICMASTER’s (Microchip’s Universal In-Circuit Emula- tor) real time trace buffer. This captured data from PICMASTER is saved to file and analyzed. Analysis was done using MathCad for Windows and DSP Analysis program from Burr-Brown (DSPLAY). The Fourier Trans- form of this Impulse response of the filter should display the Filter’s frequency response, in this case being a Low Pass type. The plots of the impulse response and the frequency response are shown in figures below. FIGURE 2 - IMPULSE RESPONSE CAPTURED FROM PIC-MASTER -4000 -2000 0 2000 4000 6000 8000 0 8 16 24 32 40 48 56 64 Impulse Response Time *0.5 (mSec) 4-130 |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |