Digital Signal Processing Reference
In-Depth Information
wn = 2*pi*f/fs ; transforms the analog cutoff frequency
vector, f Hz, to digital cutoff
frequency vector, w n , rad.
wn = wn/pi ; normalizes the digital cutoff frequency
vector
h = fir1(N, wn); calculates the FIR filter coefficients
N , are obtained, a coeffi-
cient file, bandpass.cof should be created as shown below:
Once the required filter coefficients, h ( n ), 0
n
/*bandpass.cof FIR bandpass filter coefficients file*/
#define N 51 /*length of filter*/
short hbp[N]=
{ h(0),h(1),h(2),h(3),h(10),
h(11),h(12),h(2),h(3),h(20),
h(21), h(22),h(2),h(3),h(30),
h(31), h(32),h(2),h(3),h(40),
h(41), h(32),h(2),h(3),h(50)
};
Step 2: C program to implement bandpass filter on the 'C6711 DSK
The same generic filter program fir.c , which was explained in Section 8.2,
step 2, can be utilized for this application. The program listing is given below,
however, taking care to include the appropriate bandpass coefficient file for
the application.
//Fir.c FIR filter. Include coefficient file with length N
#include “bandpass.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
 
Search WWH ::




Custom Search