0% found this document useful (0 votes)
198 views

DSP Lab Report

The document appears to be a lab report from a student named P.R. Kaaviya containing 11 experiments conducted for the course Digital Signal Processing, including generating sequences using MATLAB, implementing linear and circular convolution, correlation, z-transforms, filtering designs, and interfacing with hardware. Each experiment is summarized on its own page with aims, code, outputs, figures and results.

Uploaded by

Kaaviya
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
198 views

DSP Lab Report

The document appears to be a lab report from a student named P.R. Kaaviya containing 11 experiments conducted for the course Digital Signal Processing, including generating sequences using MATLAB, implementing linear and circular convolution, correlation, z-transforms, filtering designs, and interfacing with hardware. Each experiment is summarized on its own page with aims, code, outputs, figures and results.

Uploaded by

Kaaviya
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 28

FALL SEMESTER ACADEMIC YEAR 2019-20

ECE2006 DIGITAL SIGNAL PROCESSING


SLOT L31-L32

LAB REPORT

P.R. KAAVIYA
17BEC1006

Prof. Suchetha M
SENSE
17BEC1006

INDEX

S.NO TITLE OF THE EXPERIMENT DATE PAGE NO

1
GENERATE SAMPLE UNIT STEP, EXPONENTIAL AND
22.07.19 3
SINUSOIDAL SEQUENCES USING MATLAB

2 IMPLEMENT LINEAR AND CIRCULAR CONVOLUTION


29.07.19 7
USING MATLAB

3
PERFORM THE CORRELATION FOR THE DISCRETE
05.08.19 10
SEQUENCE USING MATLAB

4
IMPLEMENT SYSTEM RESPONSE AMD STABILITY
05.08.19 12
ANALYSIS USING Z TRANSFORM IN MATLAB

5
PERFORM DFT AND IDFT FOR A SEQUENCE USING
12.08.19 14
MATLAB

6 GENERATE SINE WAVES AND IMPLEMENT


26.08.19 16
CONVOLUTION IN CODE COMPOSER STUDIO

7 IMPLEMENT 8-POINT FFT IN CODE COMPOSER


09.09.19 18
STUDIO (VIRTUAL LAB)

8 DESIGN IIR FILTERS USING MATLAB 16.09.19 20

9 DESIGN FIR FILTER USING SPTOOL 23.09.19 24

10
INTERFACE H/W TMS320C6748 DSP DEVELOPMENT
14.10.19 27
KIT (LCDK) USING CODE COMPOSER STUDIO

11
DESIGN A FIR FILTER USING WINDOWING, HAMMING
21.10.19 28
TECHNIQUES

2
17BEC1006

EXPERIMENT 1
22.07.19
AIM: TO GENERATE SAMPLE UNIT STEP, EXPONENTIAL AND SINUSOIDAL
SEQUENCES USING MATLAB.

CODE:
% Generate unit sample sequence.

clc;
clear all;
n = -10:20;
u = [zeros(1,10) 1 zeros(1,20)];
figure(1);
subplot(1,2,1);
stem(n,u)
title('Discrete Unit Sample Sequence')
xlabel(' N value ')
ylabel('Amplitude')
subplot(1,2,2);
plot(n,u)
title('Continuous Unit Sample Function')
xlabel(' N value ')
ylabel('Amplitude')

FIGURE:

% Generate unit step sequence.

clc
clear all
n = -10:20
u = [zeros(1,10) ones(1,21)]
figure(1);
subplot(1,2,1);
stem(n,u)
title('Discrete Unit Step Sequence')
xlabel('N value ')
ylabel('Amplitude')
subplot(1,2,2);
plot(n,u)
title('Continuous Unit Step Function')
xlabel('N value ')

3
17BEC1006

ylabel('Amplitude')

FIGURE:

% Generate exponential sequence.

clc
clear all
n = 0:35
a = 1.2
k = 0.2
x = k*a.^n
figure(1);
subplot(2,1,1)
stem(n,x)
title('Discrete Exponential Sequence (Increasing)')
xlabel('N value')
ylabel('Amplitude')
a = 0.8
k=3
x = k*a.^n
subplot(2,1,2)
stem(n,x)
title('Discrete Exponential Sequence (Decreasing)')
xlabel('N value')
ylabel('Amplitude')

FIGURE:

% Generate exponential sequence with real and imaginary parts.


4
17BEC1006

clc
clear all
c = -(1/12)+(pi/6)*i
k=2
n = 0:40
x = k*exp(c*n)
figure(1);
subplot(2,1,1)
stem(n,real(x))
title('Real part of Exponential Sequence')
xlabel('Time index n'); ylabel('Amplitude')
subplot(2,1,2)
stem(n,imag(x))
title('Imaginary part of Exponential Sequence')
xlabel('Time index n'); ylabel('Amplitude')

FIGURE:

% Generation of a sinusoidal sequence.

clc
clear all
n = 0:40
f= 0.1
phase = 0
a = 1.5
arg = 2*pi*f*n-phase
x = a*cos(arg)
stem(n,x)
axis([0 40 -2 2])
grid
title('Discrete Sinusoidal Sequence')
xlabel('Time index n')
ylabel('Amplitude')

FIGURE:
5
17BEC1006

OUTPUT VERIFICATION:

RESULT: Hence, the experiment was analysed and verified with the help of graphs
and figures.

EXPERIMENT 2
6
17BEC1006

29.07.19
AIM: TO IMPLEMENT LINEAR AND CIRCULAR CONVOLUTION USING MATLAB.

CODE:
% Linear Convolution

clc
clear all
xo=input('Enter the sequence: ');
xindex=input('Enter the start index of the sequence: ');
ho=input('Enter the impulse response: ');
hindex=input('Enter the start index of the impulse response: ');
x=[xo, zeros(1,length(ho)-1)];
hl=fliplr([ho, zeros(1,length(xo)-1)]);

for i=1:length(x)
z(i)=0;
for j=1:i
z(i)=z(i)+hl(length(x)-i+j)*x(j);
end
end
z_con=conv(xo,ho);
t=(xindex+hindex):1:(length(x)-1+xindex+hindex);
figure(1)
subplot(4,1,1)
stem(t,x)
ylabel('Input Sequence')
title('Linear Convolution')
subplot(4,1,2)
stem(t,hl)
ylabel('Impulse Response')
subplot(4,1,3)
stem(t,z)
ylabel('Convolution Graph');
subplot(4,1,4);
stem(t,z_con);
ylabel('Matlab Convolution');

COMMAND WINDOW:
Enter the sequence: [1,4,5,6,3,4,6,7]
Enter the start index of the sequence: 0
Enter the impulse response: [2,2,3,5,7,1,9,7]
Enter the start index of the impulse response: 0
>> z
z=

2 10 21 39 60 86 107 143 152 171 150 112 89 105 49

FIGURE:

7
17BEC1006

% Circular Convolution

clc
clear all
xin = input('Enter input sequence : ');
h = input('Enter impulse response sequence : ');
n1=length(xin);
n2 = length(h);
n = max(n1,n2);
a=1:n;
xin = [xin,zeros(1,n-n1)];
h = [h,zeros(1,n-n2)];
y = zeros(1,n);
for i=0:n-1
for j=0:n-1
k = mod((i-j),n);
y(i+1) = y(i+1) + xin(j+1)*h(k+1);
end
end
title('CIRCULAR CONVOLUTION')
subplot(4,1,1)
stem(a,xin)
ylabel('Input Sequence')
subplot(4,1,2)
stem(a,h)
ylabel('Impulse Response')
subplot(4,1,3)
stem(a,y)
ylabel('Convoluted Sequence')
y1 = cconv(xin,h,n)
subplot(4,1,4)
stem(a,y1)
ylabel('Matlab Convolution')

COMMAND WINDOW:
Enter input sequence : [1 2 3 4]
Enter impulse response sequence : [3 4 5 6]

y1 =

46 48 46 40

FIGURE:

8
17BEC1006

OUTPUT VERIFICATION:

RESULT: Hence, the linear and circular convolution is performed and is analysed
with the help of graphs and figures.

EXPERIMENT 3
05.08.19
9
17BEC1006

AIM: PERFORM THE CORRELATION FOR THE DISCRETE SEQUENCE USING


MATLAB.
CODE:
% Compute Correlation of two sequences.

clc
clear all
xo=input('Enter the input sequence : ');
ho=input('Enter the impulse response : ');
x=[xo, zeros(1,length(ho)-1)];
h=[zeros(1,length(xo)-1),ho];

for i=1:length(x)
z(i)=0;
for j=1:i
z(i)=z(i)+h(length(x)-i+j)*x(j);
end
end

n=length(x);
t=1:n;
figure(1);

subplot(4,1,1);
stem(t,x,'bo-');
title('Input Sequence');
ylabel('Amplitude');

subplot(4,1,2);
stem(t,h,'go-');
title('Impulse Sequence');
ylabel('Amplitude');

subplot(4,1,3);
stem(t,z,'ro-');
title('Correlation Graph');
ylabel('Amplitude');

cx=xcorr(xo,ho); %Using inbuilt function


subplot(4,1,4);
stem(cx,'ro');
title('MATLAB Correlation');
ylabel('Amplitude');

corr_coeff = corrcoef(xo,ho)

COMMAND WINDOW:
Enter the input sequence : [1 2 3 5]
Enter the impulse response : [7 6 1 2]

z=

2 5 14 32 37 51 35

corr_coeff =

1.0000 -0.7956
-0.7956 1.0000

FIGURE:
10
17BEC1006

OUTPUT VERIFICATION:

RESULT: Hence, the correlation was performed and verified with the help of graphs
and figures.

EXPERIMENT 4
05.08.19
11
17BEC1006

AIM: IMPLEMENT SYSTEM RESPONSE AMD STABILITY ANALYSIS USING Z


TRANSFORM IN MATLAB.
CODE:
% Generate Z Transform function

clc;
close all;
clear all;
syms n;
f = 2^n;
z = ztrans(f);
invz = iztrans(z);
disp('Z-Transform f(z):');
disp(z);
disp('Inverse Z-Transform f(n):');
disp(invz);

COMMAND WINDOW:
Z-Transform f(z):
z/(z - 2)

Inverse Z-Transform f(n):


2^n

% Stability analysis using Z-Transform


clc
clear all
num = input('Numerator : ');
den = input('Denominator : ');
subplot(3,3,1);
zplane(num,den);
title('Z-plane');
num_a = roots(num);
den_b = roots(den);
subplot(3,3,2);
zplane(num_a,den_b);
title('Z-plane');
[z,p,k] = tf2zp(num,den);
subplot(3,3,3);
zplane(z,p);
title('Z-plane');
disp('Poles: ');disp(p);
disp('Zeros: ');disp(z);
for i=1:length(den_b)
if(abs(den_b(i))<1)
disp('System is stable.');
else if(abs(den_b(i))==1)
disp('System is marginally stable.');
else if(abs(den_b(i))>1)
disp('System is unstable.');
end
end
end
end

N = max(length(num),length(den));

12
17BEC1006

[g] = impz(num,den,N);
subplot(4,1,4);
stem(g,'ro');
title('Impulse Response');

COMMAND WINDOW:
Numerator : [0 0.5 1]
Denominator : [6 5 1]
Poles:
-0.5000
-0.3333

Zeros:
-2

System is stable.

FIGURE:

OUTPUT VERIFICATION:

RESULT: Hence, we implemented Z transform and system was analysed in Z plane


in using MATLAB.
EXPERIMENT 5
12.08.19
13
17BEC1006

AIM: TO PERFORM DFT AND IDFT FOR A DISCRETE SEQUENCE USING MATLAB.
CODE:
% To perform the DFT and IDFT.

clc
clear all;
x=input('Enter sequence x(n) : ');
N=length(x);
xk=zeros(1,N);
invxk=zeros(1,N);
j=sqrt(-1);
for k=0:N-1
for n=0:N-1
xk(k+1)=xk(k+1)+(x(n+1)*exp((-j)*2*pi*k*n/N));
end
end

for n=0:N-1
for k=0:N-1
invxk(n+1)=invxk(n+1)+(xk(k+1)*exp(j*2*pi*k*n/N));
end
end

invxk=invxk./N;
display(xk);
display(invxk);

COMMAND WINDOW:
Enter sequence x(n) : [1 2 3 4]

xk =

10.0000 + 0.0000i -2.0000 + 2.0000i -2.0000 - 0.0000i -2.0000 - 2.0000i

invxk =

1.0000 - 0.0000i 2.0000 - 0.0000i 3.0000 - 0.0000i 4.0000 + 0.0000i

% To perform the DFT and IDFT using built in function


x=input('Enter sequence x(n) : ');
y = fft(x);
display(y)
y1 = ifft(y);
display(y1)

COMMAND WINDOW:
Enter sequence x(n) : [1 2 3 4]

y=

10.0000 + 0.0000i -2.0000 + 2.0000i -2.0000 + 0.0000i -2.0000 - 2.0000i

y1 =
1 2 3 4

14
17BEC1006

OUTPUT VERIFICATION:

RESULT: Hence, for a given set of discrete values, the DFT and IDFT has been
implemented using MATLAB.

EXPERIMENT 6

15
17BEC1006

26.08.19
AIM: TO GENERATE SINE WAVES AND IMPLEMENT CONVOLUTION IN CODE
COMPOSER STUDIO.
CODE:
/*
TASK 1 - SINE WAVE GENERATOR
*/
#include <stdio.h>
#include <math.h>

float y[127];
#define freq 500

int main(void)
{
int i;
for (i = 0; i < 127; i++)
{
y[i] = sin(2 * 3.14 * freq * i / 24000);
printf("%f\n", y[i]);
}
return 0;
}
FIGURE:

/*
TASK 2 - DISCRETE TIME MULTIPLE FREQUNCY GENERATION
*/
#include <stdio.h>
#include <math.h>

float y[127];
#define fs 1000
#define f3 100
#define f2 50
#define f1 10
int main(void)
{
int i;
for (i = 0; i < 127; i++)
{
y[i] = sin((2 * 3.14 * f3 * i) / fs) + sin((2 * 3.14 * f2 * i) / fs) + sin((2 * 3.14 * f1 * i) / fs);
printf("%f\n", y[i]);
}
return 0;
16
17BEC1006

FIGURE:

/*
TASK 3 - CONVOLUTION
*/
#include <stdio.h>
#include <math.h>

#define l1 6
#define l2 4
int x[2 * l1 - 1] = {1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0};
int h[2 * l1 - 1] = {1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0};
int y[l1 + l2 - 1];

int main(void)
{
int i, j;
for (i = 0; i < (l1 + l2 - 1); i++)
{
y[i] = 0;
for (j = 0; j <= i; j++)
y[i] += x[j] * h[i - j];
}
for (i = 0; i < (l1 + l2 - 1); i++)
{
printf("%d\n", y[i]);
}
return 0;
}
OUTPUT VERIFICATION:

RESULT: Hence, the above experiment was simulated and analysed using Code
Composer Studio.
EXPERIMENT 7 (VIRTUAL LAB)
09.09.19
17
17BEC1006

AIM: TO IMPLEMENT 8-POINT FFT IN CODE COMPOSER STUDIO.


CODE:
#include <math.h>
#include <stdio.h>
#define PTS 8 //# of points for FFT
#define PI 3.14159265358979
typedef struct {float real,imag;} COMPLEX;
void FFT(COMPLEX *Y, int n); //FFT prototype
float iobuffer[PTS]; //as input and output buffer
float x1[PTS]; //intermediate buffer
short i; //general purpose index variable
short buffercount = 0; //number of new samples in iobuffer
short flag = 0; //set to 1 by ISR when iobuffer full
COMPLEX w[PTS]; //twiddle constants stored in w
COMPLEX samples[PTS]; //primary working buffer
main()
{
for (i = 0 ; i<PTS ; i++) // set up twiddle constants in w
{
w[i].real = cos(2*PI*i/(PTS*2.0)); //Re component of twiddle constants
w[i].imag =-sin(2*PI*i/(PTS*2.0)); //Im component of twiddle constants
}
for (i = 0 ; i < PTS ; i++) //swap buffers
{
iobuffer[i] = sin(2*PI*10*i/64.0);/*10- > freq, 64 -> sampling freq*/
samples[i].real=0.0;
samples[i].imag=0.0;
}
for (i = 0 ; i < PTS ; i++) //swap buffers
{
samples[i].real=iobuffer[i]; //buffer with new data
}
for (i = 0 ; i < PTS ; i++)
samples[i].imag = 0.0; //imag components = 0
FFT(samples,PTS); //call function FFT.c
for (i = 0 ; i < PTS ; i++) //compute magnitude
{
x1[i] = sqrt(samples[i].real*samples[i].real+ samples[i].imag*samples[i].imag);
printf("%f+j%f\n",samples[i].real,samples[i].imag);
}
} //end of main
void FFT(COMPLEX *Y, int N) //input sample array, # of points
{
COMPLEX temp1,temp2; //temporary storage variables
int i,j,k; //loop counter variables
int upper_leg, lower_leg;
int leg_diff;
int num_stages = 0;
int index, step;
i = 1;
do
{
num_stages +=1;
i = i*2;
}while (i!=N);
leg_diff = N/2;
step = (PTS*2)/N;
for (i = 0;i < num_stages; i++) //for N-point FFT
{
index = 0;
for (j = 0; j < leg_diff; j++)
{
for (upper_leg = j; upper_leg < N; upper_leg += (2*leg_diff))
{
lower_leg = upper_leg+leg_diff;

18
17BEC1006

temp1.real = (Y[upper_leg]).real + (Y[lower_leg]).real;


temp1.imag = (Y[upper_leg]).imag + (Y[lower_leg]).imag;
temp2.real = (Y[upper_leg]).real - (Y[lower_leg]).real;
temp2.imag = (Y[upper_leg]).imag - (Y[lower_leg]).imag;
(Y[lower_leg]).real = temp2.real*(w[index]).real
-temp2.imag*(w[index]).imag;
(Y[lower_leg]).imag = temp2.real*(w[index]).imag
+temp2.imag*(w[index]).real;
(Y[upper_leg]).real = temp1.real;
(Y[upper_leg]).imag = temp1.imag;
}
index += step;
}
leg_diff = leg_diff/2;
step *= 2;
}
j = 0;
for (i = 1; i < (N-1); i++)
{
k = N/2;
while (k <= j)
{
j = j - k;
k = k/2;
}
j = j + k;
if (i<j)
{
temp1.real = (Y[j]).real;
temp1.imag = (Y[j]).imag;
(Y[j]).real = (Y[i]).real;
(Y[j]).imag = (Y[i]).imag;
(Y[i]).real = temp1.real;
(Y[i]).imag = temp1.imag;
}
}
return;
}

FIGURE:

RESULT: Hence, the above experiment was simulated and analysed using Code
Composer Studio.

EXPERIMENT 8
16.09.19
AIM: TO DESIGN IIR FILTERS USING MATLAB.
19
17BEC1006

CODE:
% BUTTEROWORTH LOW PASS FILTER

clc
clear all
Fp=3500;
Fs=4500;
Wp=2*pi*Fp;
Ws=2*pi*Fs;
[N,Wn]=buttord(Wp,Ws,0.5,30,'s');
[b,a]=butter(N,Wn,'s');
wa=0:(3*Ws)/511:3*Ws;
h=freqs(b,a,wa);
plot(wa/(2*pi),20*log10(abs(h)),'r');
grid on
xlabel('Frequency in Hz');
ylabel('Gain in db');
title('Gain Response');
axis([0 3*Fs -60 5]);

FIGURE:

% CHEBYSHEV-I FILTER

clc
clear all
Fp=3500;
Fs=4500;
Rp=0.5;
Wp=2*pi*Fp;
Ws=2*pi*Fs;
[N,Wn]=cheb1ord(Wp,Ws,0.5,30,'s');
[b,a]=cheby1(N,Rp,Wn,'s');
wa=0:(3*Ws)/511:3*Ws;
h=freqs(b,a,wa);
plot(wa/(2*pi),20*log10(abs(h)),'g');
grid on
xlabel('Frequency in Hz');
ylabel('Gain in db');
title('Gain Response');
axis([0 3*Fs -60 5]);
FIGURE:

20
17BEC1006

% CHEBYSHEV-II FILTER

clc
clear all
Fp=3500;
Fs=4500;
Wp=2*pi*Fp;
Ws=2*pi*Fs;
[N,Wn]=cheb2ord(Wp,Ws,0.5,30,'s');
[b,a]=cheby2(N,30,Wn,'s');
wa=0:(3*Ws)/511:3*Ws;
h=freqs(b,a,wa);
plot(wa/(2*pi),20*log10(abs(h)),'b');
grid on
xlabel('Frequency in Hz');
ylabel('Gain in db');
title('Gain Response');
axis([0 3*Fs -60 5]);

FIGURE:

% BANDSTOP FILTER

Wp = [0.3 0.7];
Ws = [0.4 0.6];
[N,wn] = buttord(Wp,Ws,0.4,50);
[b,a] = butter(N,wn,'stop');
w = 0:pi/255:pi;
h = freqz(b,a,w);

21
17BEC1006

g = 20*log10(abs(h));
plot(w/pi,g,'k');
grid on;
axis([0 1 -6 5]);
xlabel('w (omega)');
ylabel('Gain');
title('Bandstop Filter');

FIGURE:

% BANDPASS FILTER
clc
clear all
fs = 300;
pass = [10 20]/fs;
A = 2;
t = (1:100)/fs;
f1 = 05; w1 = 2*pi*f1;
f2 = 15; w2 = 2*pi*f2;
f3 = 30; w3 = 2*pi*f3;
s1 = A*sin(w1*t);
s2 = A*sin(w2*t);
s3 = A*sin(w3*t);

s = s1+s2+s3;

figure(1);
subplot(4,1,1);
plot(t,s1,'r');
subplot(4,1,2);
plot(t,s2,'g');
subplot(4,1,3);
plot(t,s3,'b');
subplot(4,1,4);
plot(t,s,'m');

[b, a] = ellip(4, 0.1, 40, [10,20]*2/fs);


[h, w] = freqz(b,a,512);
figure(2);
plot(w*fs/(2*pi), abs(h),'b');
title('Response of filter')

sf = filter(b,a,s);

figure(3);
subplot(2,1,1);
plot(sf,'r');
title('Filter output');
s = fft(s,512);

22
17BEC1006

sf = fft(sf, 512);
p = (0:255)/256*(fs/2);
subplot(2,1,2);
plot(p, abs([s(1:256)' sf(1:256)']));
title('Frequency Spectrum of filtered signal');
ylabel('PSD');xlabel('Freq')
axis([-5 60 5 5]);

FIGURE:

OUTPUT VERIFICATION:

RESULT: Hence, various IIR filters were designed and analysed with the help of
graphs obtained in MATLAB.

EXPERIMENT 9
23
17BEC1006

23.09.19
AIM: TO DESIGN FIR FILTERS USING SPTOOL IN MATLAB.
CODES AND FIGURES:
>> t = 0:0.01:10;
>> s = sin(2*pi*t);
>> plot(s,'r', 'Linewidth',2);
>> s1 = sin(2*pi*5*t);
>> s2 = sin(2*pi*10*t);
>> s3 = sin(2*pi*15*t);
>> s=s1+s2+s3;
>> sptool

Signal s Signal s1

Signal s2 Signal s3

Signal s = s1 + s2 + s3

24
17BEC1006

>> clear all


>> load ecg2x60.dat _ascii
>> c=ecg2x60;
>> fs=500
>> fc=30

25
17BEC1006

OUTPUT VERIFICATION:

RESULT: Hence, FIR filter was designed using SPTOOL in MATLAB.

26
17BEC1006

EXPERIMENT 10
14.10.19
AIM: INTERFACE H/W TMS320C6748 DSP DEVELOPMENT KIT (LCDK) USING CODE
COMPOSER STUDIO.
CODE:
#include "L138_LCDK_aic3106_init.h"
interrupt void interrupt4(void)
{
uint32_t sample;

sample =input_sample();
output_sample(sample);
return;
}

int main(void) {

L138_initialise_intr(FS_48000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_LINE_INPUT);

while(1);
}

* main.c
*/
#include "L138_LCDK_aic3106_init.h"
interrupt void interrupt4(void){

int arr[100],i=0;
int final[]
for(i=0;i<100;i++)
arr[i]=0;
uint32_t sample;
sample =input_sample();
output_sample(sample);
return;
}

int main(void) {

L138_initialise_intr(FS_48000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_MIC_INPUT);
while(1);
}
OUTPUT VERIFICATION:

RESULT: Hence, the audio signal was sent from a mobile phone to a headset using
DSP hardware kit with the help of Code Composer Studio.
EXPERIMENT 11
27
17BEC1006

21.10.19
AIM: DESIGN A FIR LOW PASS FILTER USING HAMMING WINDOW TECHNIQUES
AND INTERFACE H/W TMS320C6748 DSP DEVELOPMENT KIT (LCDK) USING CODE
COMPOSER STUDIO TP FILTER AN AUDIO SIGNAL.
CODE:
#include "L138_LCDK_aic3106_init.h"

#define N 31
float h[N] = {
-0.0013355,-0.0019405,-0.00075813,0.0029505,0.0066474,0.0042262,-0.0072748,-0.019542,-0.015618,0.012825,0.047786,0.048618,-
0.017434,-0.14049,-0.26268,0.68537,-0.26268,-0.14049,-0.017434,0.048618,0.047786,0.012825,-0.015618,-0.019542,-
0.0072748,0.0042262,0.0066474,0.0029505,-0.00075813,-0.0019405,-0.0013355
};
float x[N];

interrupt void interrupt4(void)

{
short i;
float yn=0.0;
x[0] = (float)(input_left_sample());
for(i=0;i<N;i++)
yn+=h[i]*x[i];
for(i=(N-1);i>0;i--)
x[i]=x[i-1];
output_left_sample((uint16_t)(yn));
return;
}

int main(void)
{
L138_initialise_intr(FS_48000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_LINE_INPUT);
while(1);
}

OUTPUT VERIFICATION:

RESULT: Hence, the audio signal was filtered using DSP hardware kit with the help
of Code Composer Studio.

28

You might also like