Está en la página 1de 47

EXP NO: 1

SAMPLING AND RECONSTRUCTION OF LOW PASS SIGNALS


AIM:
To design and setup sampling and reconstruction circuit.
COMPONENTS REQUIRED:
1. CD4016
2. OPAMP 741 IC
3. Capacitors 0.01 microfarad
4. Resistors 15K, 10K
5. Function generators
6. Bread board
THEORY:
The low pass signal can be sampled by using CD4016 and this can be reconstructed using an RC low pass filter. CD4016 is an analog switch. The analog input signal is sampled utilizing a
train of pulses that are equally placed. The sampling produces an output pulse train in which the
amplitude of each pulse corresponds to the instantaneous amplitude of modulating signal at the
sampling instant. Thus the switch produces PAM output corresponding to the input given to it.
The original signal can be reconstructed using an envelope detector.
PROCEDURE:
1. Verify whether the components are in good condition or not. Set up the circuit as per
circuit diagram.
2. Apply input signal to the circuit.
3. Observe the output on the CRO and note down the frequency and amplitude of the
sampled signal.

4. Give sampled output as input to the reconstruction circuit and make sure that the output
of reconstruction circuit is same as the input signal.
5. Plot waveforms.

CIRCUIT DIAGRAM:

Fig 1.1: Sampling and Reconstruction


EXPECTED OUTPUT:

RESULT AND DISCUSSION:


Designed and setup circuit for sampling and reconstruction.

EXP NO: 2
IMPLEMENTATION OF DELTA MODULATOR
AIM:
To design and implement delta modulator.
COMPONENTS REQUIRED:
1.
2.
3.
4.
5.

IC 311
IC 741
IC 7474
Function generator
CRO

THEORY:
Delta modulation is a differential PCM scheme in which the difference signal is encoded into
single bit. This single bit is transmitted per sample to indicate whether the signal is larger or
smaller than the previous sample. The LM311 chip is used in circuit as a comparator and the
output of comparator is fed to the sample and hold circuit made by the D flip flop. The clock
frequency is selected at the sampling rate pulses at the output. The output of D-flip flop is fed to
an integrator and the integrator output is given as one input to the comparator as the quantized
approximation of modulating signal m(t). The modulating signal m(t) and its quantized
approximation m(t) is applied to the comparator, comparator provides a high level output when
m(t) is greater than m(t).
PROCEDURE:
1. Verify whether the components are in good condition or not. Set up the circuit as per
circuit diagram.
2. Apply input signal to the circuit.
3. Observe the output on the CRO and note down the frequency and amplitude of the
sampled signal.
4. Plot waveforms.

CIRCUIT DIAGRAM:

Fig 2.1: Delta Modulator

Expected Output:

RESULT AND DISCUSSION:


Designed and setup circuit for delta modulator.

EXP NO: 3

IMPLEMENTATION OF LINE CODING SCHEMES BIPOLAR AND MANCHESTER


CODES
AIM:
To design and implement a circuit to generate Bi-polar codes and Manchester codes.
COMPONENTS REQUIRED:
1. CD4016
THEORY:

CIRCUIT DIAGRAM:

Fig: Generation of Bipolar Codes

Fig: Generation of Manchester Codes.

PROCEDURE:
1. Verify whether the components are in good condition or not. Set up the circuit as per
circuit diagram.
2. Apply input signal to the circuit.
3. Observe the output on the CRO and note down the frequency and amplitude of the
sampled signal.
4. Plot waveforms.

RESULT AND DISCUSSION:


Designed and setup circuit for bi-polar codes and Manchester codes.

EXP NO: 4
GENERATION AND DETECTION OF BASK AND BFSK SIGNALS

AIM:
To design and setup a circuit for BASK and BFSK generation and detection.
COMPONENTS REQUIRED:

THEORY:

CIRCUIT DIAGRAM:

Fig 4.1: Generation of ASK

Fig 4.2: Detection of ASK

Fig 4.3: Generation of FSK

Fig 4.4: Detection of FSK

PROCEDURE:
1. Verify whether the components are in good condition or not. Set up the circuit as per
circuit diagram.
2. Apply input signal to the circuit.
3. Observe the output on the CRO and note down the frequency and amplitude of the
sampled signal.
4. Give sampled output as input to the reconstruction circuit and make sure that the output
of reconstruction circuit is same as the input signal.
5. Plot waveforms.

RESULT AND DISCUSSION:


Generation and demodulation of BASK and BFSK modulated waves were done.

EXP NO: 5

INTRODUCTION TO SCILAB
AIM
1. Study of SCILAB basics and getting familiar with the environment.
2. Generation of various waveforms in continuous and discrete form.
Unit impulse signal
Unit step signal
Unit ramp signal
Triangular signal
Exponential signal
Sinusoidal signal
THEORY
Scilab is an open source software for numerical mathematics and scientific visualization.
It is capable of interactive calculations as well as automation of computations through
programming. It provides all basic operations on matrices through built-in functions so that the
trouble of developing and testing code for basic operations are completely avoided. Its ability to
plot 2D and 3D graphs helps in visualizing the data we work with. All these make Scilab an
excellent tool for teaching, especially those subjects that involve matrix operations. Further, the
numerous toolboxes that are available for various specialized applications make it an important
tool for research. Being compatible with Matlab, all available Matlab M-files can be directly
used in Scilab with the help of the Matlab to Scilab translator.Scicos, a hybrid dynamic systems
modeler and simulator for Scilab, simplifies simulations. The greatest features of Scilab are that
it is multiplatform and is free. It is available for many operating systems including Windows,
Linux and MacOS X.
Scilab is a scientific software package which was developed since 1990 by researchers
from INRIA(French National Institute for Research in Computer Science and Control) andENPC
(National School of Bridges and Roads), it is now maintained anddeveloped by
ScilabConsortium since its creation in May 2003 and integrated into Digiteo Foundation in July
2008. The current version is 5.5.1 (February2010).Since 1994 it is distributed freely along with
source code through the Internet and is currently being used in educational and industrial
environments around the world. From version 5 it is released under the GPL compatible CeCILL
license.

When you start up Scilab, you see a window called Scilab console. The user enters Scilab
commands at the prompt (-->). But many of thecommands are also availablethrough the menu at
the top. Themost important menu for abeginner is the Help menu.Clicking on the Help menu
opensup the Help Browser, showing alist of topics on which help isavailable. Clicking on the
relevanttopic takes you to hyperlinkeddocuments similar to web pages. The codes for the
programs are written as SciNotes by selecting a blank note from the tope top left corner of the
Scilab Console.

PROCEDURE
1. Start Scilab on PC and Scilab console window opens. Create a new blank SciNote.
2. The code for the required program is typed and saved as Scilab SCE file with an extension .sci
3. The continuous plots are made using the function plot and discrete plots are made using the
function plot2d3 with the corresponding x axis and y axis variables written inside(). To view
all the plots in the same window the function subplot is used.
4. The typed program is run using the execute.
5. The results and the errors in the program are displayed in the console window.
PROGRAM :
GENERATION OF DISCRETE WAVEFORMS
clc;
clear all;
clf;
//UNIT IMPULSE
y=[zeros(1,10),ones(1,1),zeros(1,10)];
t=-10:1:10;

subplot(2,3,1)
plot2d3(t,y);
title('unit impulse');xlabel('t');ylabel('amp');
//UNIT STEP
x=[zeros(1,10),ones(1,11)];
t=-10:1:10;
subplot(2,3,2)
plot2d3(t,x);
title('unit step');xlabel('t');ylabel('amp');
//UNIT RAMP
t=0:1:10;
m=2; // m=1 for unit ramp , m can take any values.
y=m*t;
subplot(2,3,3);
plot2d3(t,y);
title('ramp');xlabel('t');ylabel('amp');
//TRIANGULAR FUNCTION
p=50;
t=0:1:49;
for n=1:p/2
a(n)=n;
end
for n=p/2+1:p
a(n)=p-n;
end
subplot(2,3,4)

plot2d3(t,a);
//EXPONENTIAL FUNCTION
t=0:1:25;
y=exp(0.03*t);
subplot(2,3,5)
plot2d3(t,y);
//SINUSOIDAL FUNCTION
t=0:0.0001:0.01;
f=100;
y=0.5*sin(2*%pi*f*t);
subplot(2,3,6)
plot2d3(t,y);

GENERATION OF CONTINOUS WAVEFORMS


clc;
clear all;
clf;
//UNIT IMPULSE
y=[zeros(1,10),ones(1,1),zeros(1,10)];
t=-10:1:10;
subplot(2,3,1)
plot(t,y);

title('unit impulse');xlabel('t');ylabel('amp');
//UNIT STEP
x=[ones(1,20)];
t=0:1:19;
subplot(2,3,2)
plot(t,x);
title('unit step');xlabel('t');ylabel('amp');
//UNIT RAMP
t=0:1:10;
m=2; // m=1 for unit ramp , m can take any values.
y=m*t;
subplot(2,3,3);
plot(t,y);
title('ramp');xlabel('t');ylabel('amp');
//TRIANGULAR FUNCTION
p=50;
t=0:1:49;
for n=1:p/2
a(n)=n;
end
for n=p/2+1:p
a(n)=p-n;
end
subplot(2,3,4)
plot(t,a);

//EXPONENTIAL FUNCTION
t=0:1:25;
y=exp(0.03*t);
subplot(2,3,5)
plot(t,y);
//SINUSOIDAL FUNCTION
t=0:0.0001:0.01;
f=100;
y=0.5*sin(2*%pi*f*t);
subplot(2,3,6)
plot(t,y);
RESULT AND DISCUSSION:
1. Familiarized SCILAB
2. Basic experiments to generate different waveforms in discrete and continuous time
domain were done.

EXP NO: 6
BASIC SIGNAL OPERATIONS USING Scilab
AIM

1.For a given signal generate its

Folded signal sequence


Time delayed by 3 samples
Time advanced by 2 samples

2.For the given two signals in discrete domain perform signal addition and subtraction
3.Perform linear convolution on given two sequences.
THEORY
The time reversal of a discrete time signal x(n) can be obtained by folding the sequence
about n=0 and the folded sequence is represented by x(-n). The signal time delayed by 3 samples
is obtained by shifting the sequence to right by 3 samples and it is represented with x(n-3). The
signal time advanced by 2 samples is obtained by shifting the sequence to left by 2 samples and
it is represented with x(n+2).
For discrete-time signals the sum of two sequences and difference of two sequences is
obtained by adding and subtracting the sequence values at the same index n for which the
sequences are defined.
The convolution between the input sequence x(n) and impulse response h(n) is computed
using the function convol as y=convol(x,h). If the length of x(n) is N1 and length of h(n) is
N2 , then the length of y(n) is N1+N2-1. The length of x(n) and h(n) is found using the function
length(x) and length(h) . If the sequence x(n) is starting at n1 and h(n) at n2, then sequence
y(n) starts at n1+n2.

PROGRAM
//folded sequence
clc;
clear all;
clf;
x=[0 2 3 4 5];
n=-2:1:2;
m=-n;

y=x;
subplot(2,2,1)
plot2d3(n,x);
title('orginal sequence');
subplot(2,2,2)
plot2d3(m,y);
title('folded sequence');
// shifted sequence
x=[1 2 3 4 5];
n=-2:1:2;
k=n-2;// advanced seq
subplot(2,2,3)
plot2d3(k,x);
title('advanced sequence');
l=n+3;//delayed sequence
subplot(2,2,4)
plot2d3(l,x);
title('delayed sequence');

//addition and subtraction


n1=0:10;
y1=[ones(1,5),zeros(1,6)];
y2=[zeros(1,3),ones(1,4),zeros(1,4)];
y3=y1+y2;
y4=y1-y2;
subplot(2,2,1)
plot2d3 (n1,y1);
xlabel('time');
ylabel('amplitude');

title('1st Signal');
subplot(2,2,2)
plot2d3 (n1,y2);
xlabel('time');
ylabel('amplitude');
title('2nd Signal');
subplot(2,2,3)
plot2d3(n1,y3);
xlabel('time');
ylabel('amplitude');
title('Addition of two Signals');
subplot(2,2,4)
plot2d3(n1,y4);
xlabel('time');
ylabel('amplitude');
title('Subtraction of two Signals');
// LINEAR CONVOLUTION
clear;
close;
clc;
h=[1 2 2 3];
n2=0:length(h)-1;
x=[2 -1 3];
n1=0:length(x)-1;
y=convol(x,h);
n=0:length(h)+length(x)-2;
subplot(2,2,1)
plot2d3(n2,h);
xlabel("time---->");
ylabel("amplitude----->");

title("IMPULSE RESPONSE");
subplot(2,2,2)
plot2d3(n1,x);
xlabel("time---->");
ylabel("amplitude----->");
title("INPUT RESPONSE");
subplot(2,2,3)
plot2d3(n,y);
xlabel("time---->");
ylabel("amplitude----->");
title("LINEAR CONVOLUTION");

//clear ; close ;clc;


h =[2 5 0 4];
n2 = -2: length ( h) -3;
x =[4 1 3];
n1 = -1: length ( x) -2;
y = convol (x , h ) ;
n = -3: length ( x ) + length ( h ) -5;//

RESULT AND DISCUSSION:


Different signal operations were performed using SCILAB.

EXP NO: 7
PERFORMANCE

EVALUTAION

OF

DEMODULATION SYSTEMS USING SCILAB

DIGITAL

MODULATION

AND

AIM:
To evaluate the performance of BASK and BPSK using Scilab.

THEORY:

PROGRAMS:
BASK:
//sin wave
clc;
fm=5;
t=linspace(0,1,500);
sgl=0.2*sin(2*%pi*fm*t);
subplot(3,3,1)
plot(t,sgl);
//msg sig
msg=[];
for i=1:500
if sgl(i)>0 then
msg=[msg 1];
else
msg=[msg 0];
end

end
subplot(3,3,2)
plot(t,msg);
title('msg signal-square wave');
xlabel('time');
ylabel('amplitube');
//carrier sig
fc=30;
car=.5*sin(2*%pi*fc*t);
subplot(3,3,3)
plot(t,car);
title('carrier signal');
xlabel('time');
ylabel('amplitube');
//mod sig
ask=msg.*car;
subplot(3,3,4)
plot(t,ask);
title('modulated signal');
xlabel('time');
ylabel('amplitube');
//receive signal
for k=1:5
A=0.5;
snr_db=[2 4 6 8 10];
snr(k)=10^(snr_db(k)/10);
sigma(k)=A/sqrt(snr(k));

disp(sigma(k));
theory_ber(k)=0.5*erfc(0.707*sqrt(snr(k)));
disp(theory_ber(k));
end
//demod sig
n=rand(1,500);
for q=1:5
ask_noise=ask+sigma(q)*n;
dem=ask_noise.*car;
subplot(3,3,5)
plot(t,dem);
msg2=[];
for i=1:500
if dem(i)>0 then
msg2=[msg2 1];
else
msg2=[msg2 0];
end
end
count=0;
for i=1:500
if (msg2(i)-msg(i)~=0) then
count=count+1;
end
end
BER(q)=count/500;
disp(BER(q));
end

subplot(3,3,6)
plot(t,msg2);
disp(BER);figure;
plot2d1("ll",snr_db,BER);
title("SNR vs BER");
xlabel("SNR in db");
ylabel("BERin db");

Expected Output:

BPSK:
//sin wave
clc;
fm=5;
t=linspace(0,1,500);
sgl=0.2*sin(2*%pi*fm*t);
subplot(3,3,1)
plot(t,sgl);
//msg sig
msg=[];
for i=1:500
if sgl(i)>0 then
msg=[msg 1];
else
msg=[msg -1];
end
end

subplot(3,3,2)
plot(t,msg);
title('msg signal-sine wave');
xlabel('time');
ylabel('amplitude');
//carrier sig
fc=30;
car=.5*sin(2*%pi*fc*t);
subplot(3,3,3)
plot(t,car);
title('carrier signal');
xlabel('time');
ylabel('amplitude');
//mod sig
ask=msg.*car;
subplot(3,3,4)
plot(t,ask);
title('modulated signal');
xlabel('time');
ylabel('amplitude');
//receive signal
for k=1:5
A=0.5;
snr_db=[2 4 6 8 10];
snr(k)=10^(snr_db(k)/10);
sigma(k)=A/sqrt(snr(k));
theory_ber(k)=0.5*erfc(sqrt(snr(k)));

disp(theory_ber(k));
end
//demod sig
n=rand(1,500);
for q=1:5
ask_noise=ask+sigma(q)*n;
dem=ask_noise.*car;
subplot(3,3,5)
plot(t,dem);
msg2=[];
for i=1:500
if dem(i)>0 then
msg2=[msg2 1];
else
msg2=[msg2 -1];
end
end
count=0;
for i=1:500
if (msg2(i)-msg(i)~=0) then
count=count+1;
end
end
BER(q)=count/500;
disp(BER(q));
end
subplot(3,3,6)
plot(t,msg2);

disp(BER);
figure;
plot2d1("ll",snr_db,BER,style=+2);
set(gca(),"auto_clear","off");
plot2d1("ll",snr_db,theory_ber,style=+3);
legend('Practical','Theoritical');
title('SNR V/S BER');
xlabel('SNR IN DB ------->');
ylabel('BER IN DB ------->');

EXPECTED OUTPUT:

RESULT AND DISCUSSION:


The performance of BASK and BPSK were evaluated using Scilab.

EXP NO: 8
DISCRETE FOURIER TRANSFORM
AIM
1.Find the DFT of a sequence x(n) =1, for 0n2 and 0 otherwise for N=4 and N=8. Plot
magnitude and phase plots for each.
2. Find the circular convolution of two finite duration sequences x1(n)=[1 -1 -2 3 -1] and x2(n) =
[1 2 3]
THEORY
Discrete fourier transform is found using the function fft(x,-1) and inverse discrete fourier
transform using fft(x,1). To plot the magnitude and phase response, magnitude is found using the
function abs(x) and phase using the function atan(imag(x),real(x)) .To find circular convolution
of two signals x1(n) and x2(n) their corresponding dfts are found and multiplied to get Y(K)=
X1(K)*X2(K). IDFT of Y(K) gives y(n). To find circular convolution of two sequences both the
sequences must be of same length and if not zeros are added to smallest sequence.

PROGRAM
// DFT magnitude and phase plot//
clc;
clear all;
close;
x1=[1 1 1 0];
X1=fft(x1,-1);
disp(X1,"X1(k) =");
x2=[1 1 1 0 0 0 0 0];
X2=fft(x2,-1);
disp(X2,"X2(k) =");

y1=abs(X1);
disp(y1);
n=0:1:3;
subplot(2,2,1)
plot2d3(n,y1);
y2=atan ( imag (X1),real (X1));
disp(y2);
subplot(2,2,2)
plot2d3(n,y2);
z1=abs(X2);
disp(z1);
m=0:1:7;
subplot(2,2,3)
plot2d3(m,z1);
z2=atan ( imag (X2),real (X2));
disp(z2);
subplot(2,2,4)
plot2d3(m,z2);
// Circular Convolution//
clear all;
clc ;
close ;
x1 =[1 , -1 , -2 ,3 , -1];
x2 =[1 ,2 ,3];
n1= length (x1);
n2= length (x2);
n3=n2 -n1;
if (n3>=0)
x1=[x1,zeros(1,n3)];

disp(x1);
else
x2=[x2,zeros(1,-n3)];
disp(x2);
end
//DFT Computation
X1=fft(x1 , -1);
X2=fft(x2 , -1);
Y=X1 .* X2;
//IDFT Computation
y= fft (Y ,1) ;
// Di s pl a y s e quenc e y [ n ] i n command window
disp (y,"y [ n]=");

RESULT AND DISCUSSION:


DFT, Linear convolution and Circular Convolution were performed on the given data.

EXP NO: 9

IMPLEMENTATION OF IIR FILTERS- LOW PASS AND HIGH PASS


AIM
1.For the given specifications p = 3dB,s = 15dB, p=1000 rad/s and s=500 rad/s, design a
analog butterworth high pass filter.
2.Design a chebyshev low pass filterwith the specifications p = 1dB ripple in the passband 0 w
0.2 , s = 15dB ripple in the stop band 0.3 w using bilinear transformation.
THEORY
Steps to design an analog Butterworth high pass filter
1. From the given specifications find the order of the filter N using the formula
100.1 s 1
log
100.1 p1
N=

log s
p

2. Round off it to the next higher integer.


3. Find the transfer function H(s) for c = 1 rad/s for the value of N.
4. Calculate the value of cut off frequency c
5. Find the transfer function for the value of cby substituting s=

s
c

in H(s).

Steps to design an analog chebyshev low pass filter


1. From the given specifications find the order of the filter N using the formula
0.1 s
1
1 10
cosh
0.1 p
10
1
N=

cosh 1 s
p

2. Round off it to the next higher integer.


3. Using the following formulas find the values of a and b,which are minor and major axes
of ellipse respectively

a=

1
N

1
N

1
N

1
N

[ ]
[ + ]
p b=
p
2
2

Where
= 1 + 2 +1
= 10 0.1 1
p

p= pass band frequency


p=maximum allowable attenuation pass band
4. Calculate the poles of chebyshev filter which lie on an ellipse by using the formula
Sk = acosk +jbsink , k = 1,2.N
(2 k 1)
k= +
2
2N
5. Find the denominator polynomial of the transfer function using the above poles.
6. The numerator of the transfer function depends on the value of N
a. For N odd substitute s =0 in the denominator polynomial and find the value. This
value is equal to the numerator of the transfer function.
b. For N even substitute s =0 in the denominator polynomial and divide the result by

1+ 2

. This value is equal to the numerator.

PROGRAM
// BUTTERWORTH HIGH PASS FILTER//
clc;
clear all;
clf;
ap=2;
as=10;
Wp=20;
Ws=30;
k1=sqrt(((10^(0.1*as))-1)/((10^(0.1*ap))-1));
k2=Ws/Wp;

n=log(k1)/log(k2);
disp(n);
N=ceil(n);
disp(N);
for(i=1:N)
ph(i)=%pi/2+((2*i-1)*(%pi)/(2*N));
p(i)=cos(ph(i))+%i*sin(ph(i));
//disp(ph(i));
//disp(p(i));
end
//denominator H(s)
s=%s;
H1=1;
fori=1:N
H1=H1*(s-p(i));
//disp(H1);
end
H=1/H1;
Wc=Wp/((((10^(0.1*ap))-1))^(1/(2*N)));
disp(Wc);
H2=horner(H,s/Wc);
disp(H2,'H(s)=');
// CHEBYSHEV LOW PASS FILTER//
clc;
clear all;
clf;
F=1;
ap=1;
as=15;
wp=(0.2*%pi);

ws=(0.3*%pi);
disp(wp);
disp(ws);
T=(1/F);
Wp=(2/T)*tan(wp/2);
Ws=(2/T)*tan(ws/2);
disp(Wp);
disp(Ws);
k1=sqrt(((10^(0.1*as))-1)/((10^(0.1*ap))-1));
k2=Ws/Wp;
n=acosh(k1)/acosh(k2);
//disp(n);
N=ceil(n);
disp(N);
e=sqrt((10^(0.1*ap))-1);
disp(e);
u=1/e+sqrt(1+(e^-2));
disp(u);
a=Wp*((u^(1/N)-u^(-1/N))/2);
disp(a);
b=Wp*((u^(1/N)+u^(-1/N))/2);
disp(b);
for(i=1:N)
ph(i)=%pi/2+((2*i-1)*(%pi)/(2*N));
p(i)=a*cos(ph(i))+%i*b*sin(ph(i));
//disp(ph(i));
//disp(p(i));
end
//denominator H(s)
s=%s;
H1=1;

fori=1:N
H1=H1*(s-p(i));
end
disp(H1);
//numerator H(s)
i=modulo(N,2);
disp(i);
if(i==0)
H2=(horner(H1,0))/(sqrt(1+(e^2)));
else
H2=horner(H1,0);
end
disp(H2);
H=H2/H1;
disp(H,'H(s)=');
//bilinear transformation
z=%z;
Hz=(2/T)*(horner(H,(z-1)/(z+1)));
disp(Hz,'H(z)=');

RESULT AND DISCUSSION:


Butterworth HPF and Chebyshev LPF were designed for given specifications.

EXP NO: 10

FIR FILTERS HIGH PASS AND LOW PASS


AIM
1. Design a ideal low pass filter with a frequency response for N= 11 and plot the magnitude
response

w 2

Hd(e ) = 1, 2
jw

= 0,

2 |w|

2. Design a ideal high pass filter with a frequency response for N= 11 and plot the
magnitude response . Repeat the same using a hanning window
Hd(ejw) = 1,

|w|

= 0, |w|

THEORY
The fourier series method of designing FIR filter is used in implementing FIR filter
using scilab. To get the FIR filter function the series of infinite duration obtained is truncated by
N 1
assigning h(n) = hd(n) for |n|
2

and zero for all other values, where N is the length of

desiried sequence. But abrupt truncation of fourier series results in oscillation in the pass band
and stop band. To reduce these oscillations the fourier coefficients of the filter are modified by
multiplying with a finite sequence w(n) called window
w(n) =w(-n) 0 for |n|

N 1
2

and zero for all other values.

Window can be easily implemented in scilab using the respective window


functions
win_l=window('re',n)- rectangular window
win_l=window('tr',n)- triangular window
win_l=window('hn',n)- hanning window
win_l=window('hm',n)- hamming window
win_l=window('kr',n,Beta)- Kaiser window

PROGRAM
// FIR low pass filter//
clear all;
clc ;
close ;
N =11;
U =6;
for n= -5+U :1:5+ U
if n ==6
hd(n) =0.5;
else
hd(n)=( sin (%pi *(n-U) /2) )/( %pi *(n-U));
end
end
[ hzm ,fr ]= frmag (hd ,256) ;
hzm_dB = 20* log10 (hzm)./ max ( hzm );
figure ;
plot (2* fr , hzm_dB );
a= gca ();

xlabel ( ' Frequency w ' );


ylabel ( 'Magnitude in dB ' );
title ( ' Frequency Response of FIR LPF with N=11 ' );
xgrid (2);
// FIR high pass filter//
clear all;
clc ;
close ;
N =11;
U =6;
for n= -5+U :1:5+ U
if n ==6
hd(n) =0.75;
else
hd(n)=( sin (%pi *(n-U))-sin( %pi *(n-U)/4))/( %pi *(n-U));
disp(hd(n));
end
end
[ hzm ,fr ]= frmag (hd ,256) ;
hzm_dB = 20* log10 (hzm)./ max ( hzm );
figure
plot (2* fr , hzm_dB )
a= gca ();
xlabel ( ' Frequency w' );
ylabel ( 'Magnitude in dB ' );
title ( ' Frequency Response of FIR HPF with N=11 ' );
xgrid (2);
// FIR high pass filter with hanning window//
clear all;

clc ;
close ;
N =11;
U =6;
h_hann=window('hn',N);
for n= -5+U :1:5+ U
if n ==6
hd(n) =0.75;
else
hd(n)=( sin ( %pi *(n-U))-sin( %pi *(n-U)/4))/( %pi *(n-U));
end
h(n)= h_hann (n)*hd(n);
disp(h(n));
end
[ hzm ,fr ]= frmag (h ,256) ;
hzm_dB = 20* log10 (hzm)./ max ( hzm );
figure
plot (2* fr , hzm_dB )
a= gca ();
xlabel ( ' Frequency w' );
ylabel ( 'Magnitude in dB ' );
title ( ' Frequency Response of FIR HRF with N=11 usin g Hanning Window ' );
xgrid (2);

RESULT AND DISCUSSION:


FIR filters were designed for given specifications.

EXP NO : 11
BASIC EXPERIMENTS USING DSP KIT
AIM
1. Study of digital signal processor kit TMS320C6748/ OMAPL138
2. Implementation of simple programs using TMS320C678

Sinewave generation
Linear Convolution
Discrete Fourier Transform

THEORY
The TMS320C6748 DSP development kit (LCDK) is a scalable platform that breaks
down development barriers for applications that require embedded analytics and real-time signal
processing, including biometric analytics, communications and audio. The low-cost LCDK will
also speed and ease your hardware development of real-time DSP applications. This new board
reduces design work with freely downloadable and duplicable board schematics and design files.
A wide variety of standard interfaces for connectivity and storage enable you to easily bring
audio, video and other signals onto the board.The LCDK does not have an onboard emulator. An
external emulator from TI (such as the XDS100, XDS200,XDS510, XDS560) or a third-party
will be required to start development
TMS320C6748 DSP Features
Highest-Performance Floating-Point Digital Signal Processor (DSP):
Eight 32-Bit Instructions/Cycle

32/64-Bit Data Word


375/456-MHz C674x Fixed/Floating-Point
Up to 3648/2746 C674x MIPS/MFLOPS
Rich Peripheral Set, Optimized for Audio
Highly Optimized C/C++ Compiler
Extended Temperature Devices Available
Advanced Very Long Instruction Word (VLIW) TMS320C67x DSP Core
Eight Independent Functional Units:

Two ALUs (Fixed-Point)

Four ALUs (Floating- and Fixed-Point)

Two Multipliers (Floating- and Fixed-Point)

Load-Store Architecture With 64 32-Bit General-Purpose Registers


Instruction Packing Reduces Code Size
All Instructions Conditional
Instruction Set Features
Native Instructions for IEEE 754

Single- and Double-Precision

Byte-Addressable (8-, 16-, 32-Bit Data)

8-Bit Overflow Protection


Saturation; Bit-Field Extract, Set, Clear; Bit-Counting; Normalization
67x cache memory.
32K-Byte L1P Program Cache (Direct-Mapped)
32K-Byte L1D Data Cache (2-Way)
256K-Byte L2 unified Memory RAM\Cache.
Real-Time Clock With 32 KHz Oscillator and Separate Power Rail.
Three 64-Bit General-Purpose Timers
Integrated Digital Audio Interface Transmitter (DIT) Supports:

S/PDIF, IEC60958-1, AES-3, CP-430 Formats

Up to 16 transmit pins

Enhanced Channel Status/User Data

Extensive Error Checking and Recovery


Two Inter-Integrated Circuit Bus (I2C Bus) .
3 64-Bit General-Purpose Timers (each configurable as 2 32-bit timers)
Flexible Phase-Locked-Loop (PLL) Based Clock Generator Module
IEEE-1149.1 (JTAG ) Boundary-Scan-Compatible
3.3-V I/Os, 1.2

-V Internal (GDP & PYP)

3.3-V I/Os, 1.4-V Internal (GDP)(300 MHz only)


LCD Controller
Two Serial Peripheral Interfaces (SPI) Each With Multiple Chip-Selects
Two Multimedia Card (MMC)/Secure Digital (SD) Card Interface with Secure Data I/O
(SDIO) Interfaces
One Multichannel Audio Serial Port.
Two Multichannel Buffered Serial Ports

PROCEDURE
1
2
3

Launch the CCS v6 icon from the Desktop.


Choose the location for the workspace, where your project will be saved.
To create a new project Go to File New CCS Project. Specify the name of the
project in the space provided e g., Project Name: Hello LCDK. Specify the
Device as OMAPL138 and emulator Texas Instruments XDS 100v2 USB

emulator . Select an Empty Project and click finish.


To write a program, select one new source file.
Go to File New Source File.
Specify the arbitrary source file name with .c extension. It should be in the
source folder (current project name).
Type your C Code and save
Build the program to check your code. Go to Project Build project
If your code doesnt have any errors and warnings, a message will be printed in the

console window that Build Finished


After successful Build, connect the kit with the system using the JTAG emulator

and power the kit.


Click Debug , it will direct to debug perspective automatically
Wait until the program loaded to the hardware automatically.Now you can run the
code, by selecting Run Resume. Once you run the program the output will be
printed in the Console Window.

To plot graph go to Tools Graph Single Time and set the graph properties
according to the program.

PROGRAM
1. SINE WAVE GENERATION
#include <stdio.h>
#include<math.h>
#define FREQ 1
float m[100];
void main()
{
int i=0;
for(i=0;i<99;i++)
{
m[i]=sin(2*3.14*FREQ*i/100);
printf("%f\n",m[i]);
}
}
2. LINEAR CONVOLUTION
#include<stdio.h>
#define LENGTH1 6 /*Length of i/p samples sequence*/
#define LENGTH2 4 /*Length of impulse response Co-efficient */
int x[LENGTH1+LENGTH2-1]={1,2,3,4,5,6,0,0,0,0,0}; /*Input Signal Samples*/
int h[LENGTH1+LENGTH2-1]={1,2,3,4,0,0,0,0,0,0,0}; /*Impulse Response Coefficients*/
int y[LENGTH1+LENGTH2-1];
main()

{
int i=0,j;
for(i=0;i<(LENGTH1+LENGTH2-1);i++)
{
y[i]=0;
for(j=0;j<=i;j++)
y[i]+=x[j]*h[i-j];
}
for(i=0;i<(LENGTH1+LENGTH2-1);i++)
printf("%d\n",y[i]);
}

3. DISCRETE FOURIER TRANSFORM


#include<stdio.h>
#include<math.h>
int N,k,n,i;
float pi=3.1416,sumre=0, sumim=0,out_real[8]={0.0}, out_imag[8]={0.0};
int x[32];
void main(void)
{
printf(" enter the length of the sequence\n");
scanf("%d",&N);
printf(" enter the sequence\n");
for(i=0;i<N;i++)
scanf("%d",&x[i]);
for(k=0;k<N;k++)
{
sumre=0;

sumim=0;
for(n=0;n<N;n++)
{
sumre=sumre+x[n]* cos(2*pi*k*n/N);
sumim=sumim-x[n]* sin(2*pi*k*n/N);
}
out_real[k]=sumre;
out_imag[k]=sumim;
printf("X([%d])=\t%f\t+\t%fi\n",k,out_real[k],out_imag[k]);
}
}
RESULT AND DISCUSSION:
DSP kit was familiarized and basic operations were performed using it.

También podría gustarte