Sunteți pe pagina 1din 58

SR

NO

EXPERIMENT NAME:

PAGE NO.

Signal Generation.

Signal Operation

Convolution and Correlation

14

Discrete Fourier Transform

23

Application of DSP

27

Study of Filter Design and analysis


tools.

30

Design filter with given specifications

41

CC Studio and TI6x architecture

47

Higher level language program in CCS.

49

10

Different programming techniques in


CCS.

52

11

DSK 6713 KIT

56

DATE

SIGNATURE

LAB 1
Signal Generation

AIM: Generate analog and digital signals.

RESPECTIVE MATLAB FUNCTIONS:Graphics Function

Linespace(0,2*pi,100)
fplot
hist
bar
pie
polar
semilogx
semilogy
loglog
stem
area plot
color style
line style
marker style
subplot (m,n,p)
xlabel
ylabel
title
text
legend
hold on
hold off
axis
equal
square
normal

%create a linearly space 100 elements between 0 to 2*pi


%plot a function of a single variable
%makes histograms
%crate a bar graph
%create a pi chart
%plot curves in polar co-ordinates
%make semi log plot with log scale on x axis
%make semi log plot with log scale on y axis
%create plot with log scale on the both axis
%plot a stem(discrete) graph
%plot the graph plot with style opti
%select the color

%breaks the Figure window into an m-by-n matrix of small axes, selects the p-th axes for the
current plot
%label on the x-axis
%label on the y-axis
%title of the graph
%write notes at a specified location
%produce a boxed legend on a plot
%hold the graph on figure window
%set the limits of the axis
%sets equal scale on the both axis
%sets the default rectangular frame to a square
%reset the axis to default values

Functions for signal generations:


Sin, cos, zeros, stem, ones, square, exp
Matlab codes for generating different signals and their figures:
1. Generating a Sine wave.
f=50;
t=0:0.0001:0.1;
y=sin(2*pi*f*t);
plot(t,y)

2. Generating a Cosine wave.


f=50;
t=0:0.0001:0.1;
y=cos(2*pi*f*t);
plot(t,y)

3. Generating a Square wave.


f=50;
t=0:0.0001:0.0625;
y=square(2*pi*f*t);
plot(t,y)

4. Generating a Ramp wave.


t=0:1:10;
x=t;
plot(t,x)

5. Generating a Impulse wave.


t=-10:1:10;
z=[zeros(1,10) 5 zeros(1,10)];
stem(t,z)

6. Generating a Unit Step wave.


t=-10:1:10;
z=[zeros(1,10) 1 ones(1,10)];
stem(t,z)

7. Generating a Exponential wave.


n=0:0.1:5;
y=exp(n)
plot(y)
xlabel('Time')
ylabel('Amplitude')
title('Exponential Wave')

8. Generating a Sinc wave.

t=-4*pi:0.001:4*pi;
y=sinc(t)
plot(t,y)

CONCLUSION:______________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________

Lab 2
Signal Operation
AIM: Generate analog and digital signals
1) signal shifting

clc;
clear all;
close all;
e=input('enter the range for ramp function\n');
z=0:e;
x=[z];
n=input('entr shifting index\n');
y=length(x);
subplot(1,2,1);
stem(x);
xlabel('original signal')
if n<0
a=[zeros(1,-n) x];
subplot(1,2,2);
stem(a);
else
l=-(n-1):y;
b=[x zeros(1,n)];
subplot(1,2,2);
stem(l,b);
xlabel('shifted signal')
end

OutputScreen:
(1)

right shift

(2)

Left shift:

Output screen:

2) Signal addition
clc;
close all;
clear all;
x=input('enter signal 1 value\n');
y=input('enter signal 2 value\n');
n1=length(x);
n2=length(y);
subplot(2,2,1);
stem(x);
xlabel('signal x');
subplot(2,2,2);
stem(y);
xlabel('signal y');
if n1>n2
y=[y zeros(1,n1-n2)];
else
x=[x zeros(1,n2-n1)];
end
z=x+y;
subplot(2,2,3);
stem(z);
xlabel('addition of x and y');

for unequal length of signal:

Output screen:

For equal length of signal:

Output screen:

3) Signal Folding
clc;
close all;
clear all;
x=input('Enter siganl samples')
p=input('Enter starting point')
a=length(x)
t=p:1:(p+a-1)
subplot(2,1,1)
stem(t,x)
l=t.*-1;
subplot(2,1,2)
stem(l,x)

Output screen:

4) Signal Multiplication
clc;
close all;
clear all;
x1=input('Enter siganl 1 samples\n');
p=input('Enter starting point signal 1 \n');
n1=p:(p+length(x1)-1);
x2=input('Enter siganl 2 samples\n');
q=input('Enter starting point signal 2 \n');
n2=q:(q+length(x2)-1);
n=min(min(n1),min(n2)):max(max(n1),max(n2));
y1=zeros(1,length(n));y2=y1;

y1(find((n>=min(n1))& (n<=max(n1))))=x1;
y2(find((n>=min(n2))&(n<=max(n2))))=x2;
y=y1.*y2;
subplot(2,2,1);
stem(n1,x1);
xlabel('signal 1')
subplot(2,2,2);
stem(n2,x2);
xlabel('signal 2')
subplot(2,2,3);
stem(n,y);
xlabel('multiplication of 1 and 2')

Output screen:

ASSIGNMENTS
1. X(n)=2*delta(n+2)-delta(n-4)
clc;
close all;
clear all;
n=-5:5
x1=2*[zeros(1,3) 1 zeros(1,7)]
subplot(1,3,1)
stem(n,x1)
xlabel('time')
ylabel('amplitude')
x2=(-1)*[zeros(1,9) 1 0]
subplot(1,3,2)
stem(n,x2)
xlabel('time')
ylabel('amplitude')
x=x1+x2
subplot(1,3,3)
stem(n,x)
title('final x(n)')

Output Screen:

2 .Plot x(n) =n*[u(n)-u(n-10)]+10*exp((-0.03)*(n-10))


clc;
clear all;
n=0:20;
x1=[1 ones(1,20)];
subplot(2,3,1);
stem(n,x1);
title('Lab2 assgn' )
x2=[zeros(1,10) ones(1,11)];
subplot(2,3,2);
stem(n,x2);
x3=(exp(-0.3)*(n-10));
subplot(2,3,3);
stem(n,x3);
y1=n.*(x1-x2);
subplot(2,3,4);
stem(n,y1);
y2=10*x3;
subplot(2,3,5);
stem(n,y2);
y=y1+y2;
subplot(2,3,6);
stem(n,y);

xlabel('Time');
ylabel('Amplitude');
Output Screen:

(Stepwise output of the function: x(n) =n*[u(n)-u(n-10)]+10*exp((-0.03)*(n-10))


3. Plot x(n)=cos(0.04*pi*n)+0.2*w(n).
clc;
clear all;
n=0:50;
pi=3.14;
x1=cos(n*0.04*pi);
subplot(3,1,1);
stem(n,x1);
title('lab2_Assgn2');
x2=rand(1,51);
x3=(0.2)*x2;
subplot(3,1,2);
stem(n,x3);
y=x1+x3;
subplot(3,1,3);
stem(n,y);
xlabel('Time');
ylabel('amplitude');

Output Screen:

(Stepwise output of the function: x(n)=cos(0.04*pi*n)+0.2*w(n).))

CONCLUSION:______________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________

LAB-3
Convolution and Correlation

AIM: To perform the operation of convolution.


THEORY:
Conv- Convolution and polynomial multiplication Syntax= conv(u,v)
w= conv(u,v) convolves vectors u and v.
Algebraically, convolution is the same as operation as multiplying the polynomials whose coefficients are the elements of u and v. Definition:
Let m=length (u) and n=length (v). Then w is the vector of length (m+n-1) whose kth element is the sum over all the values of j which lead to
legal subscripts for u(j) and v(k+1-j), specifically j= max(1,k+1-n): min(k,m).
When m=n, this gives
w(1) = u (1)*v (1)
w(2) = u (1)*v (2)+u(2)*v(1)
w(3)= u(1)*v(3)+u(2)*v(2)+u(3)*v(1)
...
w(n)= u(1)*v(n)+u(2)*v(n-1)+...+u(n)*v(1)
...
w(2*n-1)= u(n)*v(n)
The convolution theorem says, roughly, the convolving two sequences is the same as multiplying their Fourier transforms. In order to make this
precise, it is necessary to pad the two vectors with zeros and ignore round off error. Thus, if X=fft([x,zeros(1,length(y)-1)]) and
Y=fft([y,zeros(1,length(y)-1)]) then conv(x,y)=fft(X*Y).
Convolution:
x=[1 2 2 1];
h=[1 0 2];
z=conv(x,h)
z=
1

---------------------------------------------------------------------------------------------------x=[1 2 2 1];
h=[1 0 2];
z=conv(h,x)
z=
1

---------------------------------------------------------------------------------------------------x=[1 2 2 1];
h=[1 0 2];
z=conv(fliplr(x),h)
z=
1

---------------------------------------------------------------------------------------------------x=[1 2 2 1];
h=[1 0 2];
z=conv(fliplr(h),x)
z=
2

Observation:
1) Here from this example we conclude that changing order of functions will not change the convolution of both.
x*h=h*x
2)Here x is symmetric so convolution of x(-n) * h(n) = x(n) * h(n)
But h is not symmetric. So same is not true for h(-n).it will result in to different answer.

Matlab Code: Convolution using function


x= [1 2 2 3];
y= [2 -1 3];
z=conv (x,y);
stem(z);
xlabel(Time);
ylabel(Amplitude);
title(Convolution);

Convolution using function implementation:


u= [1 2 2 3];
v= [1 -3 4];
m=length (u);
n=length (v);
for k=1:m+n-1;
w(k)=0;
for j=max(1,k+1-n): min (k,m);
w(k)=w(k)+(u(j)*v(k+1-j));
end
end
stem(w);
xlabel (Time);

ylabel (Amplitude);
title (Convolution);

OUTPUT:

Correlation

x=[1 2 2 1];
h=[1 0 2];
z=xcorr(x,h)
z=
-0.0000

2.0000

4.0000

5.0000

4.0000 2.0000

1.0000

---------------------------------------------------------------------------------------------------x=[1 2 2 1];
h=[1 0 2];
z=xcorr(h,x)
z=
1.0000

2.0000

4.0000

5.0000

4.0000

2.0000 -0.0000

---------------------------------------------------------------------------------------------------x=[1 2 2 1];
h=[1 0 2];
z=xcorr(x,x)
z=
1.0000

4.0000

8.0000 10.0000

8.0000 4.0000

1.0000

---------------------------------------------------------------------------------------------------x=[1 2 2 1];
h=[1 0 2];
z=xcorr(h,h)
z=
2 0 5 0
x=[1 2 2 1];
h=[1 0 2];
z=xcorr(x,fliplr(h))

z=
-0.0000

1.0000

2.0000 4.0000

5.0000 4.0000

2.0000

----------------------------------------------------------------------------------------------------

x=[1 2 2 1];
h=[1 0 2];
z=xcorr(fliplr(x),h)
z=
-0.0000

2.0000

4.0000

5.0000

4.0000 2.0000

Observation:
Here from these examples we conclude that in correlation,
1)z(n) = x(n) ** h(n) => z(-n) = h(n) ** x(n)
2) Auto correlation is having even symmetry.
Rxx(n) = Rxx(-n)
Correlation using inbuilt function:
A=[1 2 3 4];
B=[1 2 3 4];
s2=xcorr(A,B);
stem(s2);
xlabel('value of k')
ylabel('value of s2(k)')
title('correlation')

1.0000

ASSIGNMENTS:
1. Perform correlation operation without using functions.
Ans. Correlation is convolution of first and folded second sequence.
u= [1 2 3 4];
z= [1 2 3 4];
a=0:3;
[v,b]=sigfold (z,a); %use function to fold signal (like in lab 2)
m=length (u);
n=length (v);
for k:m+n-1;
w(k)=0;
for j=max (1,k+1-n): min (k,m);
w(k)=w(k)+ (u(j)*v(k+1-j));
end
end
stem(w);
xlabel (value of k);
ylabel (value of w(k));
title (correlation);

RADAR SYSTEM:

To understand concept of correlation and to understand its use in RADAR application.


RADAR is acronym of Radio Detection And Ranging.As its full name says RADAR is used to detect if any object is there or not in the
path of transmission of wave and to know how far it is.
Above task can be done in this way:

1)We transmit radio wave.After some delay time we can receive the reflected wave.
2)We also know the propagation velocity of transmitted wave.
3)So,according to v=d/t, we can calculate the distance of object from transmission place.
CODE:

clc;
clear all;
close all;
D=15;

% Delay amount

x=[0 1 2 3 2 1 0];

%Triangle pulse transmitted by radar

n=[-3 -2 -1 0 1 2 3];
% n=[0 1 2 3 4 5 6];
[nd xd]=sigshift(x,n,D);

% x(n-D)

figure;
subplot(2,1,1);
stem(n,x);
title('Original Signal');
subplot(2,1,2);
stem(nd,xd);
title('Delayed Signal');

w=rand(1,length(x));

% Random noise w(n)

nw=nd;
figure;
stem(nw,w);
title('Noisy Signal');

% If object is present we receive the signal y(n)


[ny y]=sigadd(xd,nd,w,nw); % Received signa at radar y(n) = x(n-D) + w(n)
figure;
stem(ny,y);
title('Received Noisy Signal');

[nrxy rxy]=corr1(x,n,y,ny); % Cross correlaiton between x(n) and y(n)


figure;
subplot(2,1,1);
stem(nrxy,rxy);
title('Correlation in the Presenance of Object');

% If object is absent we recive only noise signal w(n)


subplot(2,1,2);
[nrxw rxw]=corr1(x,n,w,nw); % Cross correlation between x(n) and w(n)
stem(nrxw,rxw);
title('Correlation in the absenance of Object');
For executing above program function files shown below should be made:
1) function [n,y]=conv1(x1,n1,x2,n2)
nmin=min(n1)+min(n2);

% Lowest index of y(n)

nmax=max(n1)+max(n2);

% Highest index of y(n)

n=nmin:nmax;
y=conv(x1,x2);
2) function [n,y]= corr1(x1,n1,x2,n2)
[n3,x3]=timereversal(x2,n2);

%Folding of x2(n)

[n,y]=conv1(x1,n1,x3,n3);

%convolution

3) function [n,y]= sigadd(x1,n1,x2,n2)


m1=min(n1);
m2=min(n2);
st=min(m1,m2);
l1=max(n1);
l2=max(n2);
en=max(l1,l2);
n=st:en;
y1=zeros(1,length(n));y2=y1;
y1(find((n>=m1)&(n<=l1)==1))=x1;
y2(find((n>=m2)&(n<=l2)==1))=x2;
y=y1+y2;
4) function [n1,y]=sigshift(x,n,n0)
n1=n+n0;
y=x;
5) function [n1,y]=timereversal(x,n)
n1=-fliplr(n);
y=fliplr(x);

Graphical Representation of various signals:

Figure 1

Figure 2:

Figure 3:

CONCLUSION:______________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________

Lab-4
Discrete Fourier Transform
AIM: To Perform operation of DFT & IDFT with and without MATLAB inbuilt function.
THEORY:
The DSP processors are used to perform frequency analysis of signals. To do the frequency analysis we should convert the time domain signal
into the frequency domain.
For this , the different frequency transformation techniques are used. Using DTFT (discrete
Time Fourier transform) we can convert the discrete time domain sequence into frequency
Domain. But X(w) is a continuous function of frequency and therefore it is not a convenient
Representation of x(n).
So, we represent sequence x(n) by samples of its spectrum X(w). Such a frequency domain
Representation leads to DFT.(Discrete Fourier transform).
N-1
X(K)= x(n) e(-j 2*pi*k*n)/N , K=0,1,2,.... N-1
n=0
N-1
x(n)= 1/N X(K) e(j 2*pi*k*n)/N , n=0,1,2,.... N-1
K=0
DFT computes N equally spaced frequency samples of the DTFT. Both the indices n and
K are ranging from 0 to N-1.The integer n is known as time index since it denotes the time instant. The integer K denotes discrete frequency
and is called frequency index.
RESPECTIVE MATLAB FUNCTIONS:
FFT(X) : is the discrete Fourier transform (DFT) of vector X. For matrices, the FFT operation is applied to each column.
FFT(X,N): is the N-point FFT, padded with zeros if X has less than N points and truncated if it has more.
FFT(X,[ ],DIM) or FFT(X,N,DIM) applies the FFT operation across the dimension DIM.
Y = fftn(X) returns the discrete Fourier transform (DFT) of X, computed with a multidimensional fast Fourier transform (FFT) algorithm. The
result Y is the same size as X.
Y = fftn (X,siz) pads X with zeros, or truncates X, to create a multidimensional array of size siz before performing the transform. The size of the
result Y is siz.
Y = fftshift(X) rearranges the outputs of fft, fft2, and fftn by moving the zero-frequency component to the center of the array. It is useful for visualizing a
Fourier transform with the zero-frequency component in the middle of the spectrum.
Y = fftshift(X,dim) applies the fftshift operation along the dimension dim.
y = ifft(X) returns the inverse discrete Fourier transform (DFT) of vector X, computed with a fast Fourier transform (FFT) algorithm. If X is a
matrix, ifft returns the inverse DFT of each column of the matrix.
DFT and IDFT without using MATLAB inbuilt function:
%%%%%%%%%%%%%%%%DFT%%%%%%%%%%%%%%%%
x=[1 2 3 4];
N=length(x);
for k=1:N
y(k)=0;
for n=1:N
y(k)=y(k)+(x(n)*(exp(-i*2*pi*(k-1)*(n-1)/N)));
end
end
disp(y)
Answer::
10.0 -2.0000 + 2.0000i -2.0000 - 0.0000i -2.0000 - 2.0000i
%%%%%%%%%%%%%%%%IDFT%%%%%%%%%%%%%%%%
x=[10 -2+i*2 -2 -2-i*2];
N=length(x);
for n=1:N
y(n)=0;
for k=1:N
y(n)=y(n)+(x(k)*(exp(i*2*pi*(k-1)*(n-1)/N)));
end
y(n)=y(n)/N;
end
disp(y)
Answer::
1.0000 2.0000 + 0.0000i 3.0000 - 0.0000i 4.0000 - 0.0000i

DFT without using MATLAB inbuilt function:


CODE:
x=[1,2,3,4]
subplot(3,1,1)
stem(x)
title('x(n)')
y=fft(x)
subplot(3,1,2)
stem(y)
title('Fast Fourier Transform of x(n)')
subplot(3,1,3)

z=ifft(y)
stem(z)
title('Inverse Fourier Transform of x(n)')
OUTPUT:

DFT without using MATLAB inbuilt function:


FUNCTION:
function[Xk]=dft(xn,N)
n=0:1:N-1
k=0:1:N-1
wN=exp(-j*2*pi/N)
nk=n'*k
wNnk=wN.^nk
Xk=xn*wNnk
CODE:
xn=[1,2,3,4]
N=4
[Xk]=dft(xn,N)
a=real(Xk)
b=imag(Xk)
subplot(2,2,1)
stem(a)
title('Real Part of fft(x)')
subplot(2,2,2)
stem(b)
title('Imaginary Part of fft(x)')
OUTPUT:

IDFT without using MATLAB inbuilt function:


Function:
function[Xn]=idft(Xk,N)
n=0:1:N-1
k=0:1:N-1
wN=exp(j*2*pi/N)
nk=n'*k
wNnk=wN.^nk
Xn=Xk*wNnk/N
CODE:
Xk=[10,-2+i*2,-2,-2-i*2]

N=4
[Xn]=idft(Xk,N)
yn=real(xn)
stem(xn)
title('IDFT of y(n)')
OUTPUT:

APPLICATION OF DFT:
To find the frequency components of a signal buried in a noisy time domain signal.
Consider data sampled at 1000 Hz. Form a signal containing 50 Hz and 120 Hz and corrupt it with some zero-mean random noise.
CODE:
t = 0:0.001:0.6;
x = sin(2*pi*50*t)+sin(2*pi*120*t);
y = x + 2*randn(size(t));
plot(1000*t(1:50),y(1:50))
title('Signal Corrupted with Zero-Mean Random Noise')
xlabel('time (milliseconds)');
Y = fft(y,521);
f = 1000*(0:256)/512;
plot(f,abs(Y(1:257)));
title('Frequency content of y');
xlabel('frequency (Hz)')
OUTPUT:

CIRCULAR FOLDING:
If g(t)G(w) then g(t-t0)G(w)e(-jwt0). Here time shift of t0 does not affect the magnitude spectrum. It augments the phase.

CODE:
n=0:10
x=10*(0.8).^n
y=x(mod(-n,11)+1)
subplot(2,1,1)
stem(n,x)
title('x(n)')
subplot(2,1,2)
stem(n,y)
title('y(n)')
X=fft(x,11)
Y=fft(y,11)
figure
subplot(2,2,1)
stem(n,real(X))
title('Real part of dft(X)')
subplot(2,2,2)
stem(n,real(Y))
title('Real part of dft(Y)')
subplot(2,2,3)
stem(n,imag(X))
title('Imaginary part of dft(X)')
subplot(2,2,4)

stem(n,imag(Y))
title('Imaginary part of dft(Y)')

OUTPUT:

CONCLUSION:______________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________

Lab-5
Application of DSP
Aim:
To understand the application of DSP and study sound processing inMATLAB.

Introduction:
Digital signal processing has a varied applications.MATLAB is a tool with which we can perform various Digital Signal Processing. Also processing
of sound signal is possible with MATLAB.
Following applications of DSP are discussed below:
Generation of ECG signals without noise.
Generation of ecg signal with noise.
DTMF
Sound processing
ECG without Noise:
clear all;
close all;
cycle=zeros(1,500);
y=[01 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 0]/4;
t=[0:1:40];
a=(.05*(t-20).*(t-20)-20)/50;
cycle(1:61)=2*[y a];
cyc=filter([1 1 1 1 1], [1], cycle);
x=[cyc cyc cyc cyc cyc];
[idum, nsize]=size(x);
t=[0:1:nsize-1]/500;
plot(t,x);xlabel('Time(sec)');ylabel('Amplitude');
title('ECG signal');

ECG with noise:


clear all;
close all;
x=-5:0.1:5;
a=2;
b=1;
y=(-50+((a*x.*x)+(b*x)))/2;
b=y;
x=[0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0];
a=10*x;
z=[a y 3+zeros(1,300)]
c=z+randn(1,length(z));
k=[c c c];
s=[1,1,1,1];
t=[1,1];
q=filter(s,t,k);
plot(q);

DTMF:
clear all;
clc;
freq_row = [697 770 852 941];
freq_column = [1209 1336 1477];
r = 1;
no = 1;
for cell_no = 1:no
c_no = input('press no.','s');
switch c_no
case '*', row = 4; column = 1;
case '0', row = 4; column = 2;
case '#', row = 4; column = 3;
otherwise,
d_no = c_no - '0';
column = (mod((d_no - 1),3))+1;
row = ((d_no - column)/3)+1;
end
freq_samp = 32768;
t = 0:(1/freq_samp):0.25;
sig1 = sin(2*pi*freq_row(row)*t);
sig2 = sin(2*pi*freq_column(column)*t);
sig = (sig1 + sig2)/2;
sig3 = double(sig)/256;
n = length(sig3);
t1 = (0:n-1)/freq_samp;
p = abs(fft(sig3));
f = (0:n-1)*(freq_samp/n);
subplot(1,2,r);
r = r+1;
plot(f,p);
axis([500 1700 0 50]);
title('freq domain plot');
subplot(1,2,r);
plot(t,sig);
title('time domain plot');
r = r+1;
end

CONCLUSION:______________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________

Lab 6
Filter Designing Analysis Tool
Aim:
To study the Filter designing tool in MATLAB.

Theory:
The Filter Design and Analysis Tool (FDA Tool) is a powerful user interface for designing and analyzing filters quickly. FDA Tool enables you to
design digital FIR or IIR filters by setting filter specifications, by importing filters from your MATLAB workspace, or by adding, moving or deleting
poles and zeros. FDA Tool also provides tools for analyzing filters, such as magnitude and phase response and pole-zero plots.
Design Filter: See Choosing a Filter Design Method for more information. You use this panel to Design filters from scratch. Modify existing filters
designed in FDATool. Analyze filters.
Import filter: See Importing a Filter Design for more information. You use this panel to Import previously saved filters or filter coefficients that you
have stored in the MATLAB workspace, Analyze imported filters.
Pole/Zero Editor. See Editing the Filter Using the pole/Zero Editor. You use this panel to add, delete, and move poles and zeros in your filter design.

Following is the initial window of FDA tool.

Different Basic Windows used in Filtering:


1)Rectangular Window:

2)Triangular Window:

3)Hann Windowing:

4)Hamming Window:

5)Kiser Windowing:

Different kind of filtering using different windows:


FIR:
1)Low pass Kiser windowing:

Impulse response:

Pole and zero plot

Group delay

2) Low pass Hamming windowing:


Magnitude plot:

Impulse response:

Pole zero plot:

Group delay:

3)High pass Triangular windowing:


Magnitude plot:

Impulse response:

Pole zero plot:


Group delay:

4)High pass Hann windowing:


Magnitude response:

Impulse response:

Pole zero plot:

Group delay:

5) Pass band Rectangular windowing:


Magnitude response:

Impulse response:

Pole zero plot:

Group delay:

6) Stop band Rectangular windowing:


Magnitude response:

Impulse response:

Pole zero plot:

Group delay:

IIR:
1)Butterworth Low pass:
Magnitude plot

Impulse response:

Pole zero plot:

Group delay:

2)Butterworth High pass:


Magnitude plot

Impulse response:

Pole zero plot:

Group delay:

CONCLUSION:______________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________

LAB 7
Designing filter with given specifications
Aim:
Design and implement an analog filter with given specification.

Introduction:
Analog filters are indispensable in many situations. The front end of most digital signal
processing devices is an anti aliasing analog filter that limits the input signal to a range
of frequencies that the digital filter can handle.
The design of classical analog filters is based on approximating the magnitude or phase
specification by polynomials or rational functions.
Of the four classical filter types based on magnitude specifications, the Butterworth filter is monotonic in the pass band and stop band, the Chebyshev
I filter displays ripples in the pass band but is monotonic in the stop band, the Chebyshev II filter displays ripples in the stop band but is monotonic
in the pass band, and the elliptical filter has ripples in both bands.
Butterworth highpass Filter
clc;
clear all;
close all;
Fs= 0.4000;
Fp= 0.5000;
As= 80;
Ap= 1;
hs = fdesign.highpass(Fs,Fp,As,Ap);
butter(hs);

Butterworth lowpass filter


clc;
clear all;
close all;
Fp= 0.4;
Fs= 0.5;
Ap= 1;
As= 80;
hs = fdesign.lowpass(Fp,Fs,Ap,As);
butter(hs);

Butterworth bandpass filter


clc;
clear all;
close all;
Fp1= 0.25;
Fst1= 0.35;
Fst2= 0.65;
Fp2= 0.75;
Ap1= 1;
Ast= 60;
Ap2= 1;
hs = fdesign.bandstop(Fp1,Fst1,Fst2,Fp2,Ap1,Ast,Ap2);
butter(hs);

Butterworth bandstop filter


clc;
clear all;
close all;
Fp1= 0.25;
Fst1= 0.35;
Fst2= 0.65;
Fp2= 0.75;
Ap1= 1;
Ast= 60;
Ap2= 1;
hs = fdesign.bandstop(Fp1,Fst1,Fst2,Fp2,Ap1,Ast,Ap2);
butter(hs);

Chebyshev highpass filter


clc;
clear all;
close all;
Fs= 0.4000;
Fp= 0.5000;
As= 80;
Ap= 1;
hs = fdesign.highpass(Fs,Fp,As,Ap);
cheby2(hs);

Chebyshev lowpass filter


clc;
clear all;
close all;
Fp= 0.4;
Fs= 0.5;
Ap= 1;
As= 80;
hs = fdesign.lowpass(Fp,Fs,Ap,As);
cheby2(hs);

Chebyshev bandpass filter


clc;
clear all;
close all;
Fst1= 0.35;
Fp1= 0.45;
Fp2= 0.55;
Fst2= 0.65;
Ast1=60;
Ap= 1;
Ast2= 60;
hs = fdesign.bandpass(Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2);
cheby2(hs);

Chebyshev bandstop filter


clc;
clear all;
close all;
Fp1= 0.25;
Fst1= 0.35;
Fst2= 0.65;
Fp2= 0.75;
Ap1= 1;
Ast= 60;
Ap2= 1;
hs = fdesign.bandstop(Fp1,Fst1,Fst2,Fp2,Ap1,Ast,Ap2);
cheby2(hs);

CONCLUSION:______________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________

Assignment 1
Plot the frequency response for 10th order lowpass butterworth filter having cutoff frequency 1khz.
clc;
clear all;
close all;
n=10;
Fp=1000/10000;
[z,p,k]=butter(n,Fp,'low');
[sos,g] = zp2sos(z,p,k);
Hd = dfilt.df2tsos(sos,g);
h = fvtool(Hd);
set(h,'Analysis','freq')

Assignment 2
Design lowpass butterworth digital filter for given specification
fp=0.4
fs=0.5
Ap=1db
As=80 db
clc;
clear all;
close all;
Ap=1;
As=80;
wp=0.4;
ws=0.5;
[n,wn]=buttord(wp,ws,Ap,As);
[z,p,k]=butter(n,wn,'low');
[sos,g] = zp2sos(z,p,k);
Hd = dfilt.df2tsos(sos,g);
h = fvtool(Hd);
set(h,'Analysis','freq');

Assignment 3
Design bandpass butterworth digital filter
f1=0.35
f2=0.45
f3=0.55
f4=0.65
Ap=1db

As=60 db on both sides


clc;
clear all;
close all;
Ws=[0.35 0.65];
Wp=[0.45 0.55];
Ap=1;
As=60;
[n,wn]=buttord(Wp,Ws,Ap,As);
[z,p,k]=butter(n,wn,'bandpass');
[sos,g] = zp2sos(z,p,k);
Hd = dfilt.df2tsos(sos,g);
h = fvtool(Hd);
set(h,'Analysis','freq');

Lab 8
Code Composer Studio
Aim:
Introduction to CCStudio and study of T16x architecture through CCS help.
a. To create a simple project using C file.
b. Perform simulator feature viewing memory and graph.
c. To study T16x CPU architecture through help.
METHOD:
A. To create a simple project using .C file.
Set up CCS for simulator C67xx CPU
Open CCS
Create a project: Choose project - new - Type the project name say exp1; location to be \ti6x\myprojects; project type .out; target 67xx
Create a .c source file: Using a CCS editor, choose, file - new - source file write a simple .C program to print a message Welcome to learning
TI6x.
Create a .cmd command file: These are basically a system command files which informs the CCS about memory configuration i.e. the defined
segments in a project have to be loaded into which part of the memory, whether internal, external, serial etc.
Adding files to the project: We need to combine the created files as a project. For that choose project -add files to the project- select the files
to be added lab1a.c and ..ti6x\tutorials\hello1\hello.cmd. We also need to add a library file from \ti6x\C6000\cgtools\lib\rts6700.lib
Building project: Building is compiling + linking, which creates executable .out file. Only compiling or linking options are also available.
Choose project - build Before building a project we can set proper building options for linker, compiler and optimization level. Here, .c file is
converted into the equivalent machine code for 67x processor
Higher level to lower level conversion requires optimization.
Loading the program: Now we can load the program into the DSP memory choosing file - load program options.
Running a file: Select Debug - run to run the program and see the result on stdout window.
B. To add .asm file to a project.
create a new .asm file which contains a data to display a sine wave. As we are not to call this .asm file in the main program, it should be a data file.
Add this file to the project.
Make a change in the .cmd file. The data is defined in the mydata section (a user defined name). So, we need to declare in the .cmd file that this
section should be written in SDRAM area.
Build and load the project as before. If there is error in each line, upon building, the reason may be an assembly code requires that all of the lines in
the file not start from the first column. Verify this and modify accordingly. By double clicking on the error message will open the file and point the
cursor at the line where the error is.
Run it. The output is displayed.
C. To view data in memory and through graph.
Select view - memory Select the memory location. In our case it is 0x80000000 Format: 16-bit signed int A memory window appears where the
results can be obtained.
Select view - graph - time/frequency start address: 0x80000000 Acquisition buffer size: 10 Display data size: 10 DSP data size: 16-bit signed integer
A graph will appear on the screen with a plot of value v/s element number
Program to print HELLO on screen
#include<stdio.h>
void main()
{
printf(HELLO);
}
Output:
HELLO

CONCLUSION:______________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________

LAB 9
Higher level language Program in CCS
AIM: Add assembly file to project through CCS.
a. To add assembly file to a project.
PROGRAM STATEMENT:
c. Write a program to display a message Welcome to the world of TI6x using .c program.
d. Add .asm file, which contains a table with 10 values to generate a sine wave.
REQUIREMENTS:
CCStudio for 6x
METHOD:
A. To add .asm file to a project.
i. create a new .asm file which contains a data to display a sine wave. As we are not to call this .asm file in the main program, it should be a data file.
ii. Add this file to the project.
iii. Make a change in the .cmd file. The data is defined in the mydata section (a user defined name). So, we need to declare in the .cmd file that this section
should be written in SDRAM area.
iv. Build and load the project as before. If there is error in each line, upon building, the reason may be an assembly code requires that all of the lines in the file
not start from the first column. Verify this and modify accordingly. By double clicking on the error message will open the file and point the cursor at the line
where the error is.
v. Run it. The output is displayed.

Sample program
Write a program to generate Full Wave Sinusoidal signal in CCS.
#include<stdio.h>
main()
{
float *p=(float*)0x80000000,pi=3.14;
int f=100,t;
for(t=0;t<360,t++)
{
h=sin(2*pi*f*t);
*p=(float)h;
p++;
}
}

CONCLUSION:______________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________

Assignment-1
Write a program to generate Full wave rectified sinusoidal signal in CCS.
#include<stdio.h>
main()
{
float *p=(float*)0x80000000,pi=3.14;
int f=100,t;
for(t=0;t<360,t++)
{
h=sin(2*pi*f*t);
if (h<=0)
{
h = -h;
}
*p=(float)h;
p++;
}
}

Assignment-2
Write a program to generate half wave rectified sinusoidal signal in CCS.
#include<stdio.h>
main()
{
float *p=(float*)0x80000000,pi=3.14;
int f=100,t;
for(t=0;t<360,t++)
{
h=sin(2*pi*f*t);
if (h<0)
{
h = 0;
}
*p=(float)h;
p++;
}
}

LAB 10
Programming Techniques in CCS
AIM: To Perform different programming techniques.
i. C calling assembly function
ii. C calling linear assembly function.
PROGRAM STATEMENT:
a. Write a .C program, calling .asm function to multiply two arrays.
b. Write a .C program to Find Factorial of entered No. using C calling ASM function(assembly
REQUIREMENTS:
CCStudio for 6x
THEORY about PROGRAMMING TI 6713:
Options: To program TI 6713 there are so many alternative options
1. Only C/C++: CCS project can have only .c source file
2. Assembly: CCS project can have only .asm source file
3. Linear Assembly: CCS project can have only .sa linear assembly source file
4. Mixed: CCS project can have .c calling .asm ; .c calling .sa; .asm calling .asm
1. Programming through .c
Usual .c syntax
Program written using higher level is converted into an assembly level program. Over the last couple of years, C compiler optimizer has become
more and more efficient. Although C code is less efficient (speed performance) than assembly level program, it typically involves less coding
effort than assembly code which can be hand optimized to achieve a 100 percent efficiency but with much better coding effort.
2. Assembly Level Programming:
A. Instructions: The format of the assembly code line is:
lable parallel bar [condition] instruction unit operands ;comments An assembly must contain only the label in the first column. So other than
labels, directives or mnemonics can not start from the first column.
B. Assembler directives:
The smallest unit of the object file is called section.
A section is a block of code or data that occupies space in the memory map with other sections.
There are two basic types of sections.
Initialized sections: They contain code or data. E.g. .text, .data, .sect
Uninitialized sections: They reserve space in the memory map for uninitialized data. It is a place for creating and storing variables during
execution. E.g. .bss, .usect
Object files always contain three default sections: .text, .data, .bss
.text To declare the following section as program
.data To declare the following section as data
.sect name defines a section of code or data named name and associates subsequent code or data with that section. Ex. mydata
.bss symbol, size in bytes reserves space for uninitialized variables
.
Other directives are:
Directive that reference or define files
.def ; .ref; .global
Directives that initialize constants (data and memory)
.byte; .short; .float, .int , .double
Directives that define symbols at assembly time
.equ; .set
3. Linear Assembly Programming:
A. General Programming:
In linear assembly programming, syntax of assembly code instructions: ADD, SUB is utilized. But the operands operands are written as in C.
Variables are used to designate the registers. Say,
MPY a, b, prod
ADD prod, sum, sum
Parallel instructions are not valid in a linear assembly program.
Specifying the functional unit, register or NOPs is optional.
B. An alternative to .c or .asm is linear assembly .sa program. An assembler optimizer is used with linear assembly program to create a .asm
program, in much the same way as C compiler is used with .c to .asm conversion. The assembler optimizer gives better performance than the c
compiler optimizer.
In short, linear assembly code programming provides a compromise between a coding effort and coding efficiency.
C. Assembler Directives:
.cproc and .endproc:
.cproc is the directive to declare the following section of code as C callable linear assembly function. It is used always with .endproc, which
indicates end of the linear assembly function.
Syntex: label ,cproc a, b, prod
Where, the label is a name of the procedure and a, b, prod are the variables being passed. All the input and output parameters being passed must
be written after .cproc as we pass parameter to a C functions.
.proc and .endproc:
They are used to define a general procedure start and end.

The .cproc directive differs from the .proc directive in that the compiler treats the .cproc region as a C/C++ callable function. The assembly
optimizer performs some operations automatically in a .cproc region in order to make the function conform to the C/C++ calling conventions
and to C/C++ register usage conventions.
.return This directive is used to return result of calling function.
.reg - The .reg directive allows you to use descriptive names for values that are stored in registers. The assembly optimizer chooses a register for
you such that its use agrees with the functional units chosen for the instructions that operate on the value.
.reg ahi:alo
ADD a0,ahi:alo,ahi:alo
.def defines a function
4. Mixed programming mode:
The mixed programming mode is possible where c program can call assembly or linear assembly functions or assembly program calls an
assembly level procedure.
C calling assembly:
Declaration and call reference:
In the c program, calling an assembly function syntax is same as we are calling a c function.
An external declaration of an assembly function called within a c program using extern directive is optional. Say, extern short
dotp_assem_func()
:
:
result = dotp_assem_func(ap, bp);
The function name should be defined in .asm using .def directive and the function name should be preceded by an undescore, which indicates
that this is a c callable .asm function. I.e. .def _dotp_assem_func
The name of the *.c file should not be same as the *.asm file.
Parameter passing:
The parameters passed through the C program are in terms of variables.
These parameters are available as input parameters to an assembly level procedure through registers A4, B4, A6, B6, A8, sequentially.
Same way, the output parameter is always through A4. (Only one retur parameter as per C notation.)
The return address has to be passed through B3.
C calling linear assembly:
Enough has been discussed before
Assembly calling assembly:
The calling assembly program has to be defined as init and correspondingly the first assembly code line should be given a label init.
Other declaration and parameter passing is in the same way.
System Initialization:
After reset from where the processor should start the execution that has to be informed. Processor executes an interrupt service routine (ISR) for
reset interrupt, where we can write a code to branch (jump) to the our required program.
If there is a .c program in our project, before we can run a C/C++ program, other than this initialization, we must create the C/C++ run-time
environment. The C/C++ boot routine performs this task using a function called c_int00. The run-time-support source library, rts.src, contains
the source to this routine in a module called boot.c. That is why, if our project contains .c program then it is compulsory to add to the project the
run time support source library file.
If there is no .c program in our project, then to inform the processor to start the program execution after reset from our defined init procedure, we
have to add a vector.asm file to our project, which basically is an reset interrupt service routine (ISR) to make a branch (jump) to the required
location.
If there is no .c program in our project, before building the project, we must modify the linker option (Project
Options) to select No
Autoinitializtion. Otherwise, the warning entry point symbol _c_int00 undefined is displayed on building this project with no main() function
ion C.
PROGRAM:
//Dotp4clasm.c Multiplies two arrays using C calling linear ASM func
short dotp_lasm_func(short *a,short *b,short ncount); //prototype
#include <stdio.h> //for printing statement
//#include "dotp4.h" //arrays of data values
#define count 4 //number of data values
short x[count] = {1,4,2,6}; //declare 1st array
short y[count] = {6,9,5,8}; //declare 2nd array
int result = 0; //result
main()
{
result = dotp_lasm_func(x,y,count); //call linear ASM func
printf("result = %d decimal \n", result); //print result
}
Dotp4afunc.asm Multiply two arrays. Called from dotp4a_init.asm
;A4=x address,B4=y address,A6=count(size of array),B3=return address
.def dotp_lasm_func; dot product function
.text ; text section dotp_lasm_function
MOV A6,A1 ;move loop count -->A1
ZERO A7 ; init A7 for accumulation
loop LDH *A4++,A2 ;A2=(x. A4 as address pointer
LDH *B4++,B2 ;B2=(y). B4 as address pointer
NOP 4 ;4 delay slots for LDH
MPY .M1x B2,A2,A3 ;A3 = x * y
NOP ;1 delay slot for MPY
ADD A3,A7,A7 ;sum of products in A7
SUB A1,1,A1 ;decrement loop counter
[A1] B loop ;branch back to loop till A1=0
NOP 5 ;5 delay slots for branch

MOV A7,A4 ;A4=result A4=return register


B B3 ;return from func to addr in B3
NOP 5 ;5 delay slots for branch
PROGRAM:
Find Factorial of entered No. using C calling ASM function(assembly)
//Factorial.c Finds factorial of n. Calls function factfunc.asm
#include <stdio.h> //for print statement
extern short fact_func(short);
void main()
{
short n=5; //set value
int result; //result from asm function
scanf("%d",&n);
//if (n!=0)
result = fact_func(n); //call assembly function factfunc
//else result=1;
printf("no. = %d \n factorial = %d\n",n,result); //print result from asm function
}
OUTPUT WATCH WINDOW:

;FACT_FUNC.ASM Assembly function called from C to find factorial


.def _fact_func ;asm function called from C
_fact_func: MV A4,A1 ;setup loop count in A1
ZERO A4
ADD A4,1,A4
[A1] B LOOP
NOP 5
B B3
NOP 5
LOOP: MPY A4,A1,A4 ;accumulate in A4
NOP ;for 1 delay slot with MPY
SUB A1,1,A1 ;decrement for next multiply
[A1] B LOOP ;branch to LOOP if A1 # 0
NOP 5 ;five NOPs for delay slots
B B3 ;return to calling routine
NOP 5 ;five NOPs for delay slots
END
INPUT
INPUT VALUE: 5
OUTPUT
FACTORIAL= 120
CONCLUSION:______________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________

Lab 11
DSK 6713 KIT
AIM : Introduction to DSK 6713 Kit
PROCEDURE:
1)
2)
3)
4)
5)
6)

Open 6713 DSK Diagnostics


Press start if kit is connected properly it will show PASS otherwise FAIL
Then open ccstudio setup.
Available factory board-family-platform-select C6173 DSK C67xx-dsk
Save and quit
Open project
-Built
-Connect
-Rebuilt
-Load
-Run

7) Then see the Output on the kit

PROGRAM:
/*
* Copyright 2003 by Spectrum Digital Incorporated.
* All rights reserved. Property of Spectrum Digital Incorporated.
*/

/*
* ======== led.c ========
*
* This example blinks LED #0 at a rate of about 2.5 times per second using
* the LED module of the the DSK6713 Board Support Library. The example
* also reads the state of DIP switch #3 and lights LED #3 if the switch
* is depressed or turns it off if the switch is not depressed.
*
* The purpose of this example is to demonstrate basic BSL usage as well
* as provide a project base for your own code.
*
* Please see the DSK6713 help file for more detailed information.
*/

/*
* DSP/BIOS is configured using the DSP/BIOS configuration tool. Settings
* for this example are stored in a configuration file called led.cdb. At
* compile time, Code Composer will auto-generate DSP/BIOS related files
* based on these settings. A header file called ledcfg.h contains the

* results of the autogeneration and must be included for proper operation.


* The name of the file is taken from led.cdb and adding cfg.h.
*/
#include "ledcfg.h"

/*
* The Board Support Library is divided into several modules, each
* of which has its own include file. The file dsk6713.h must be included
* in every program that uses the BSL. This example also includes
* dsk6713_led.h and dsk6713_dip.h because it uses the LED and DIP modules.
*/
#include "dsk6713.h"
#include "dsk6713_led.h"
#include "dsk6713_dip.h"

/*
* main() - Main code routine, initializes BSL and runs LED application
*/

/*
* EXTRA: Pressing DIP switch #3 changes LED #3 from off to on.
*/

void main()
{
/* Initialize the board support library, must be first BSL call */
DSK6713_init();

/* Initialize the LED and DIP switch modules of the BSL */


DSK6713_LED_init();
DSK6713_DIP_init();

while(1)
{
/* Toggle LED #0 */
DSK6713_LED_toggle(0);

/* Check DIP switch #3 and light LED #3 accordingly, 0 = switch pressed */


if (DSK6713_DIP_get(2) == 0)

/* Switch pressed, turn LED #3 on */


DSK6713_LED_on(2);
else
/* Switch not pressed, turn LED #3 off */
DSK6713_LED_off(2);

/* Spin in a software delay loop for about 200ms */


DSK6713_waitusec(200000);
}
}

CONCLUSION:______________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________

S-ar putea să vă placă și