FIR Filter Low pass/High pass (LP/HP) Using Kaiser window
Aim: To verify FIR Filter Low pass/High pass (LP/HP) Using Triangular window
SOFTWARE REQUIREMENTS:
Operating System – Windows XP
Constructor - Simulator
Software – Code Composer 3.1v,6713DSK Diagnostics
HARDARE REQUIREMENTS:
TMS320C67XXDSP KIT / example TMS320C6713DSP KIT
USB cable
Power Supply +5v
1.Kaiser window (High pass)
Program:
include "filtercfg.h"
#include "dsk6713.h"
#include "dsk6713_aic23.h"
#include "stdio.h"
//float filter_coeff[ ]={0.000050,0.000223,0.000520,0.000831,0.000845,
// -0.000000,-0.002478,-0.007437,-0.015556,-0.027071,
// -0.041538,-0.057742,-0.073805,-0.087505,-0.096739,
// 0.899998,-0.096739,-0.087505,-0.073805,-0.057742,
// -0.041538,-0.027071,-0.015556,-0.007437,-0.002478,
// -0.000000,0.000845,0.000831,0.000520,0.000223,
// 0.000050};
//FIR High pass Kaiser filter pass band range 400Hz-3.5KHz
//float filter_coeff[ ]={0.000000,-0.000138,-0.000611,-0.001345,-0.001607,
// -0.000000,0.004714,0.012033,0.018287,0.016731,
// 0.000000,-0.035687,-0.086763,-0.141588,-0.184011,
// 0.800005,-0.184011,-0.141588,-0.086763,-0.035687,
// 0.000000,0.016731,0.018287,0.012033,0.004714,
// -0.000000,-0.001607,-0.001345,-0.000611,-0.000138,
// 0.000000};
//FIR High pass Kaiser filter pass band range 800Hz-3.5KHz
float filter_coeff[ ]={-0.000050,-0.000138,0.000198,0.001345,0.002212,-0.000000,
-0.006489,-0.012033,-0.005942,0.016731,0.041539,0.035687,
-0.028191,-0.141589,-0.253270,0.700008,-0.253270,-0.141589,
-0.028191,0.035687,0.041539,0.016731,-0.005942,-0.012033,
-0.006489,-0.000000,0.002212,0.001345,0.000198,-0.000138,
-0.000050};
//FIR High pass Kaiser filter pass band range 1200Hz-3.5KHz
//static short int in_buffer[100];
DSK6713_AIC23_Config config={0x0017,0x0017,0x00d8,0x00d8,0x0011,0x0000,0x0000,0x0043,0x0081,0x0001};
void main( )
{
DSK6713_AIC23_CodecHandle hCodec;
Uint32 l_input, r_input,l_output, r_output;
DSK6713_init();
hCodec = DSK6713_AIC23_openCodec(0, &config);
DSK6713_AIC23_setFreq(hCodec, 1);
while(1)
{
while(!DSK6713_AIC23_read(hCodec, &l_input));
while(!DSK6713_AIC23_read(hCodec, &r_input));
l_output=(Int16)FIR_FILTER(&filter_coeff ,l_input);
r_output=l_output;
while(!DSK6713_AIC23_write(hCodec, l_output));
while(!DSK6713_AIC23_write(hCodec, r_output));
}
DSK6713_AIC23_closeCodec(hCodec);
}
signed int FIR_FILTER(float * h, signed int x)
{
int i=0;
signed long output=0;
static short int in_buffer[100];
in_buffer[0] = x;
for(i=30;i>0;i--)
in_buffer[i] = in_buffer[i-1];
for(i=0;i<32;i++)
output = output + h[i] * in_buffer[i];
//output = x;
return(output);
}
Expected Output: Observed the output in CRO with respect to input signal, it pass the signal at range of pass band frequency 1200-3.5KHz,and attenuate at other than pass band frequency
2. Kaiser window (Low pass)
PROGRAM CODE:
#include "filtercfg.h"
#include "dsk6713.h"
#include "dsk6713_aic23.h"
#include "stdio.h"
//float filter_coeff[]={-0.000019,-0.000170,-0.000609,-0.001451,-0.002593,
// -0.003511,-0.003150,0.000000,0.007551,0.020655,
// 0.039383,0.062306,0.086494,0.108031,0.122944,
// 0.128279,0.122944,0.108031,0.086494,0.062306,
// 0.039383,0.020655,0.007551,0.000000,-0.003150,
// -0.003511,-0.002593,-0.001451,-0.000609,-0.000710,
// -0.000019};
// kaiser low pass fir filter pass band range 0-500Hz
//float filter_coeff[]={-0.000035,-0.000234,-0.000454,0.000000,0.001933,
// 0.004838,0.005671,-0.000000,-0.013596,-0.028462,
// -0.029370,0.000000,0.064504,0.148863,0.221349,
// 0.249983,0.221349,0.148863,0.064504,0.000000,
// -0.029370,-0.028462,-0.013596,-0.000000,0.005671,
// 0.004838,0.001933,0.000000,-0.000454,-0.000234,
// -0.000035};
// kaiser low pass fir filter pass band range 0-1000Hz
float filter_coeff[]={-0.000046,-0.000166,0.000246,0.001414,0.001046,
-0.003421,-0.007410,0.000000,0.017764,0.020126,
-0.015895,-0.060710,-0.034909,0.105263,0.289209,
0.374978,0.289209,0.105263,-0.034909,-0.060710,
-0.015895,0.020126,0.017764,0.000000,-0.007410,
-0.003421,0.001046,0.001414,0.000246,-0.000166,
-0.000046};
//Kaiser low pass fir filter pass band range 0-1500Hz
//static short int in_buffer[100];
DSK6713_AIC23_Config config={0x0017,0x0017,0x00d8,0x00d8,0x0011,0x0000,0x0000,0x0043,0x0081,0x0001};
void main( )
{
DSK6713_AIC23_CodecHandle hCodec;
Uint32 l_input, r_input,l_output, r_output;
DSK6713_init();
hCodec = DSK6713_AIC23_openCodec(0, &config);
DSK6713_AIC23_setFreq(hCodec, 1);
while(1)
{
while(!DSK6713_AIC23_read(hCodec, &l_input));
while(!DSK6713_AIC23_read(hCodec, &r_input));
l_output=(Int16)FIR_FILTER(&filter_coeff ,l_input);
r_output=l_output;
while(!DSK6713_AIC23_write(hCodec, l_output));
while(!DSK6713_AIC23_write(hCodec, r_output));
}
DSK6713_AIC23_closeCodec(hCodec);
}
signed int FIR_FILTER(float * h, signed int x)
{
int i=0;
signed long output=0;
static short int in_buffer[100];
in_buffer[0] = x;
for(i=30;i>0;i--)
in_buffer[i] = in_buffer[i-1];
for(i=0;i<32;i++)
output = output + h[i] * in_buffer[i];
//output = x;
return(output);
}
Expected Output: Observed the output in CRO with respect to input signal, it pass the signal at range of pass band frequency 0-1500KHz, and attenuate at other than pass band frequency.
-
UpdatedFeb 04, 2020
-
Views1,281
Generation of basic signals using MATLAB
Design of FIR filters of Low pass and high pass filter using Matlab commands
Find DFT / IDFT of given DT signal
Implementation of analog IIR low pass and high pass filter for a given sequence
Find frequency response of a given system given in (Transfer Function/ Differential equation form
Implementation of FFT of a given sequence