<< Chapter < Page Chapter >> Page >
You will implement a fourth-order, elliptical, low-pass infinite impulse-response (IIR) filter as a cascade of two second-order sections.

Overview

In this lab, you implement a fourth-order IIR filter completely in fixed-point C. While programming in C provides ease of coding, portability, and comprehension, fixed-point processing raises a few challenges that were handled automatically in assembly. In particular, it is the programmer's responsibility to explicitly handle overflow errors and accumulator sizing.

On the DSP, you will write and test the C function for the elliptic low-pass filter designed from Prelab (Part 1) . You should not try to implement the notch filter designed in Prelab (Part 2) , because it will not work correctly when implemented using Direct Form II. (Why not?)

To implement the fourth-order filter, start with a single set of second-order coefficients and implement a single second-order section. A suggested outline of the implementation steps are:

  1. On paper, design the algorithm for a modular implementation of a single second-order section.
  2. Write the algorithm in C, handling truncation, overflow, saturation, and accumulator sizing.
  3. Verify functionality of this single bi-quad using the frequency sweep test-vector, and the function generator/oscilloscope.
  4. In Matlab, pair the poles and zeros to maximize the gain factors for each section, and on the DSP, verify the correct operation of each bi-quad independently.
  5. Finally, write C code to implement the cascade. The modular design of the second-order section should convince you of the benefits of C programming.

Part 1: design on paper

The first step, and the majority of the work, is to implement a single second-order section, which was shown in Figure 1 . Before writing in C, carefully design and plan out the algorithm on paper in pseudo-code. For an example of how pseudo-code is used to implement an FIR filter, see this link FIR filter implementation.

From your design, you should have a very clear idea about:

  • the chronological order of how the intermediate states {w[n], w[n-1], w[n-2]}, and the output, y[n]should be updated.
  • how pointers or data should move after sample x[n] has been processed, but before x[n+1]comes in.
  • the data types required for all buffers, accumulators, and temporary variables you may need.

Which buffer should be circularly addressed: coefficients or state buffer?

The intermediate state buffer. If you do not clearly understand why, go back to Figure 1 and spend more time on this part of the lab!

Part 2: c implementation of a second-order section

You may want to implement the second-order section with the following function declaration:

long iirSoS(int *b, int *a, int *w_states, long input);

The above declaration is only a recommendation, and the exact number of arguments or even the datatypes used can be designed differently. The point though, is that this specification enables function re-use, unlike Lab 2 where different assembly functions were written for each filter.

In the suggested function declaration above, the first two arguments are pointers to the filter coefficients, the third argument is a pointer to the intermediate state buffer, and the final argument is the current input sample. The returned value is the output of the given second-order section.

Questions & Answers

1. Discuss the processes involved during exchange of fluids between intra and extracellular space.
Mustapha Reply
what are components of cells
ofosola Reply
twugzfisfjxxkvdsifgfuy7 it
Sami
58214993
Sami
what is a salt
John
the difference between male and female reproduction
John
what is computed
IBRAHIM Reply
what is biology
IBRAHIM
what is the full meaning of biology
IBRAHIM
what is biology
Jeneba
what is cell
Kuot
425844168
Sami
what is biology
Inenevwo
what is cytoplasm
Emmanuel Reply
structure of an animal cell
Arrey Reply
what happens when the eustachian tube is blocked
Puseletso Reply
what's atoms
Achol Reply
discuss how the following factors such as predation risk, competition and habitat structure influence animal's foraging behavior in essay form
Burnet Reply
cell?
Kuot
location of cervical vertebra
KENNEDY Reply
What are acid
Sheriff Reply
define biology infour way
Happiness Reply
What are types of cell
Nansoh Reply
how can I get this book
Gatyin Reply
what is lump
Chineye Reply
what is cell
Maluak Reply
what is biology
Maluak
what is vertibrate
Jeneba
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Ece 420 spring 2014. OpenStax CNX. Jan 18, 2014 Download for free at http://cnx.org/content/col11618/1.3
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Ece 420 spring 2014' conversation and receive update notifications?

Ask