IIR Chebyshev Filter (LP/HP) on DSP processors
AIM: To verify IIR Chebyshev Filter (LP/HP) using Code Composer Studio.
SOFTARE REQUIREMENTS:
Operating System – Windows XP
Constructor - Simulator
Software – Code Composer Studio3.1v, 6713DSK Diagnostics.
HARDARE REQUIREMENTS:
TMS320C6713DSP KIT
USB cable
Power Supply +5v The
CRO (0-20MHz),
Function Generator (1-1MHz), Cables
PROCEDURE:
1. Set 1v peak to peak in function generator, and connect this to 6713kit at Line in pin, connect CRO to kit at Line out pin.
2. Open code composer studio
3. create a new project ,give a meaningful name ,save into working folder, select target as TMS320C6713,and select output file type is execution. Out.
4. Click on file opennewsource file save it with .c extension in working folder and write C-code for desired task.
4. Filenew dsp \bios configuration file select DSK6713.cdB. save it with .cdb extension in working folder.
5. Add .cdb file to project [pathright click on dsp\ Bios configuration select .cdb file] and choose .cdb file.
6. Add the library file ‘dsk6713bsl.lib’ to the current project. [Path c.\ccstudio\c600\dsk6713\lib\dsk6713bst.lib]
7. Under working folder include 3-header files
“dsk6713.h”
“dsk6713_aic23.h”
“Filtercfg.h”(pathc:\ccstudio\c6000\dsk6713\include.)
8. Compile the program.
9. Build the program.
10. Connect the kit and load the program then run.
11. In the CRO we can verify the output signal with input signal.
2. Chebyshev (High pass)
PROGRAM CODE:
#include "filtercfg.h"
#include "dsk6713.h"
#include "dsk6713_aic23.h"
#include "stdio.h"
//const signed int filter_coeff[] = {12730,-12730,12730,32767,-18324,21137};
//IIR_CHEB_HP FILTER pass band range 2.5kHz-11KHz
//const signed int filter_coeff[] = {9268,-9268,9268,32767,-7395,18367};
//IIR_CHEB_HP FILTER pass band range 4kHz-11KHz
const signed int filter_coeff[] = { 3842,-3842,3842,32767,12360,19289};
//IIR_CHEB_HP FILTER pass band range 7kz-11KHz
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, 3);
while(1)
{
while(!DSK6713_AIC23_read(hCodec, &l_input));
while(!DSK6713_AIC23_read(hCodec, &r_input));
l_output=IIR_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 IIR_FILTER(const signed int * h, signed int x1)
{
static signed int x[6] = {0,0,0,0,0,0};
static signed int y[6] = {0,0,0,0,0,0};
int temp=0;
temp = (short int)x1;
x[0] = (signed int) temp;
temp = ( (int)h[0] * x[0]);
temp += ( (int)h[1] * x[1]);
temp += ( (int)h[1] * x[1]);
temp += ( (int)h[2] * x[2]);
temp -= ( (int)h[4] * y[1]);
temp -= ( (int)h[4] * y[1]);
temp -= ( (int)h[5] * y[2]);
temp >>=15;
if ( temp > 32767 )
{
temp = 32767;
}
else if ( temp < -32767)
{
temp = -32767;
}
y[0] = temp;
y[2] = y[1];
y[1] = y[0];
x[2] = x[1];
x[1] = x[0];
return (temp<<2);
}
Expected Output: Observed the output in CRO with respect to input signal, it pass the signal at range of pass band frequency 7-11KHz, and attenuate at other than pass band frequency.
2. Chebyshev (Low pass)
PROGRAM CODE:
#include "filtercfg.h"
#include "dsk6713.h"
#include "dsk6713_aic23.h"
#include "stdio.h"
//const signed int filter_coeff[] = {1455,1455,1455,32767,-23410,21735};
//IIR_CHEB_LP FILTER pass band range 0-2.5kHz
//const signed int filter_coeff[] = {168,168,168,32767,-30225,28637};
//IIR_CHEB_LP FILTER pass band range 0-800Hz
const signed int filter_coeff[] = {11617,11617,11617,32767,8683,15506};
//IIR_CHEB_LP FILTER pass band range 0-8kHz
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, 3);
while(1)
{
while(!DSK6713_AIC23_read(hCodec, &l_input));
while(!DSK6713_AIC23_read(hCodec, &r_input));
l_output=IIR_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 IIR_FILTER(const signed int * h, signed int x1)
{
static signed int x[6] = {0,0,0,0,0,0};
static signed int y[6] = {0,0,0,0,0,0};
int temp=0;
temp = (short int)x1;
x[0] = (signed int) temp;
temp = ( (int)h[0] * x[0]);
temp += ( (int)h[1] * x[1]);
temp += ( (int)h[1] * x[1]);
temp += ( (int)h[2] * x[2]);
temp -= ( (int)h[4] * y[1]);
temp -= ( (int)h[4] * y[1]);
temp -= ( (int)h[5] * y[2]);
temp >>=15;
if ( temp > 32767 )
{
temp = 32767;
}
else if ( temp < -32767)
{
temp = -32767;
}
y[0] = temp;
y[2] = y[1];
y[1] = y[0];
x[2] = x[1];
x[1] = x[0];
return (temp<<2);
}
Expected Output: Observed the output in CRO with respect to input signal, it pass the signal at range of pass band frequency 0-8KHz, and attenuate at other than pass band frequency.
-
UpdatedFeb 04, 2020
-
Views1,447
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