Digital Signal Processing Reference
In-Depth Information
Step 2: Create C program to implement bandstop filter on the '6711 DSK
The C program basically executes the filter operation, defined by the
following convolution equation, which was discussed initially in
Chapter 2 .
yn
()
=
xkhn k
()(
)
(8.1)
k
=−∞
The C language filter program fir.c is given below. Some of the important
features of the program are as follows:
The program fir.c is a very generic program and can be used for the
implementation of any kind of FIR filter, as defined by the operation
in Equation 8.1. It is only the coefficient file, bandstop.cof , which
has to be changed according to the type of filter. Ultimately, it is only
the numbers within the coefficient file that govern the nature of the
filter, which is one of the remarkable advantages in the implemen-
tation of digital systems.
Hence, the same program, fir.c , can be used for the other two appli-
cations in this laboratory, taking care to include the appropriate
coefficient file for the application.
//fir.c FIR filter. Include coefficient file with length N
#include “bandstop.cof”
//coefficient file
int yn = 0;
//initialize filter's output
short dly[N];
//delay samples
interrupt void c_int11()
//ISR
{
short i;
dly[0] = input_sample(); //new input @ beginning of
buffer
yn = 0;
//initialize filter's output
for (i = 0; i< N; i++)
yn += (h[i] * dly[i]); //y(n) += h(i)* x(n-i)
for (i = N-1; i > 0; i—) //starting @ end of buffer
dly[i] = dly[i-1];
//update delays with data
move
Search WWH ::




Custom Search