next up previous
Next: About this document ...

EE 451

Lab 4: FIR Filters and the 56000

1.
The Fourier transform of a low-pass filter will have a value of 1 for low frequencies and a value of 0 for high frequencies:


\begin{displaymath}H(\omega) = \left\{ \begin{array}{ll}
1 & \mbox{if $\vert\om...
...if $\omega_0 < \vert\omega\vert < \pi $ }
\end{array} \right. \end{displaymath}

Consider a low-pass filter with the cutoff frequency $\omega_0 = \pi/4$. Find the impulse response h(n) of this discrete-time system by taking the inverse Fourier transform of H(w).

2.
h(n) has an infinite number of terms, so cannot be implemented. We can get an approximation of h(n) by taking a limited number of terms. Write a MATLAB program to find the 101 terms of h(n), $n = -50, \cdots, 50$. Print out a stem plot of this truncated impulse response, ht(n).

3.
Use MATLAB to take the Fourier transform of ht(n). Plot the frequency response |H(f)| vs f and phase of H(f) vs f.

4.
Implement the FIR filter on the 56002. The program fir.asm is a macro to implement an FIR filter on the 56002, and the program firt.asm shows how to use the macro. Note that when you call the fir macro, it expects the new input data x(n) to be in the x0 register, and when it exits, the new output data y(n) will be in the a accumulator. You need to reserve storage in x data space for the input data (states in the firt program), and need to put the filter coefficients in the y data space (coef in the firt program). Before you call the fir macro the first time, you need to set up r0 to point at the input data array, r4 to point at the filter coefficients, and m0 and m4 to be modulo the number of coefficients in the filter.

Your filter uses 101 coefficients. It would be tedious and error-prone to type these coefficients into your program by hand. Instead, modify your MATLAB program to print the coefficients out for you in a way that they can automatically be included in your program. Here is a program fragment which can do this:

fid = fopen('lab4coef.asm','w');
fprintf(fid,'ntaps   equ   %d\n\n',length(h));
fprintf(fid,'        org   x:$100\n');
fprintf(fid,'states  dsm   ntaps\n\n');
fprintf(fid,'        org   y:$100\n');
fprintf(fid,'coef\n');
for n=1:length(h)
    fprintf(fid,'        dc    %d\n',h(n));
end
fclose(fid)

5.
Measure the frequency response of the filter. Compare the frequency response to the plots of Part 1.

6.
This it a 100th order filter. What is the maximum order filter you could implement on the 56002, keeping the 48 kHz sampling rate?



 
next up previous
Next: About this document ...
Bill Rison
1998-09-22