66667106-Lab-Manual
-
Upload
gyanbitt-kar -
Category
Documents
-
view
215 -
download
0
Transcript of 66667106-Lab-Manual
-
8/2/2019 66667106-Lab-Manual
1/38
1
LABORATORY MANUAL
ECE 303 and ECE353
Unified Electronics Lab-III
-
8/2/2019 66667106-Lab-Manual
2/38
2
S.No Name of the Experiments Sr no
MATLAB
1. To develop program for designing an FIR and IIR filter 3
2. To develop a program for Computing discrete Convolution and Correlation 10
3. To develop a program for Computing Circular Convolution 13
4. To develop a program for Computing DFT and IDFT in MATLAB
5. To develop a program for Computing Inverse Z-Transform
BREAD BOARD
6. To design and implement on a breadboard a circuit to perform Amplitude
Modulation.
MTE
7. To design and implement on a breadboard a circuit to perform Frequency
Modulation.
8. Compile, Elaborate, and Simulate a 2-to-1 mux Design using IncisiveSimulator
MICROPROCESSOR
9. Interfacing and control of stepper motor using 8085 microprocessor.
10. Generation of delay in binary counting using 8085 microprocessor.
11. To implement a moving 7-segment display with suitable delay using 8085
microprocessor.
12. Write a program to interface two digit numbers using seven Segment
LEDs, use 8086 microprocessor and 8255 PPI.
-
8/2/2019 66667106-Lab-Manual
3/38
3
FIR filters
AIM: To verify FIR filters.
EQUIPMENTS:
ConstructorMATLAB Software
THEORY:
A Finite Impulse Response (FIR) filter is a discrete linear time-invariant system whoseoutput is based on the weighted summation of a finite number of past inputs. An FIR transversal
filter structure can be obtained directly from the equation for discrete-time convolution.
In this equation, x(k) and y(n) represent the input to and output from the filter at time n.h(n-k) is the transversal filter coefficients at time n. These coefficients are generated by using
FDS (Filter Design Software or Digital filter design package).FIR filter is a finite impulse response filter. Order of the filter should be specified.
Infinite response is truncated to get finite impulse response. placing a window of finite lengthdoes this. Types of windows available are Rectangular, Barlett, Hamming, Hanning, Blackmann
window etc. This FIR filter is an all zero filter.
PROGRAM:
%fir filt design window techniquesclc;
clear all;
close all;
rp=input('enter passband ripple');rs=input('enter the stopband ripple');
fp=input('enter passband freq');fs=input('enter stopband freq');
f=input('enter sampling freq ');wp=2*fp/f;
ws=2*fs/f;num=-20*log10(sqrt(rp*rs))-13;
dem=14.6*(fs-fp)/f;
n=ceil(num/dem);n1=n+1;if(rem(n,2)~=0)
n1=n;n=n-1;
endc=input('enter your choice of window function 1. rectangular 2. triangular 3.kaiser: \n ');
-
8/2/2019 66667106-Lab-Manual
4/38
4
if(c==1)y=rectwin(n1);
disp('Rectangular window filter response');end
if(c==2)
y=triang(n1);disp('Triangular window filter response');end
if(c==3)y=kaiser(n1);
disp('kaiser window filter response');end
%LPFb=fir1(n,wp,y);
[h,o]=freqz(b,1,256);m=20*log10(abs(h));
subplot(2,2,1);plot(o/pi,m);title('LPF');
ylabel('Gain in dB-->');xlabel('(a) Normalized frequency-->');
%HPFb=fir1(n,wp,'high',y);
[h,o]=freqz(b,1,256);m=20*log10(abs(h));
subplot(2,2,2);plot(o/pi,m);title('HPF');
ylabel('Gain in dB-->');xlabel('(b) Normalized frequency-->');
%BPFwn=[wp ws];
b=fir1(n,wn,y);[h,o]=freqz(b,1,256);
m=20*log10(abs(h));subplot(2,2,3);plot(o/pi,m);
title('BPF');ylabel('Gain in dB-->');
xlabel('(c) Normalized frequency-->');%BSF
b=fir1(n,wn,'stop',y);[h,o]=freqz(b,1,256);
m=20*log10(abs(h));subplot(2,2,4);plot(o/pi,m);
title('BSF');ylabel('Gain in dB-->');
xlabel('(d) Normalized frequency-->')
-
8/2/2019 66667106-Lab-Manual
5/38
5
RESULTS:
-
8/2/2019 66667106-Lab-Manual
6/38
6
-
8/2/2019 66667106-Lab-Manual
7/38
-
8/2/2019 66667106-Lab-Manual
8/38
8
if(c==2)disp('Frequency response of IIR HPF is:');
[b,a]=butter(n,wn, 'high','s');end
w=0:.01:pi;
[h,om]=freqs(b,a,w);m=20*log10(abs(h));an=angle(h);
figure,subplot(2,1,1);plot(om/pi,m);title('magnitude response of IIR filter is:');
xlabel('(a) Normalized freq. -->');ylabel('Gain in dB-->');
subplot(2,1,2);plot(om/pi,an);title('phase response of IIR filter is:');
xlabel('(b) Normalized freq. -->');ylabel('Phase in radians-->');
RESULTS:
-
8/2/2019 66667106-Lab-Manual
9/38
9
-
8/2/2019 66667106-Lab-Manual
10/38
10
LINEAR CONVOLUTION AND CORRELATION
AIM: To verify Linear Convolution.
EQUIPMENTS:Software -- MATLAB 7.5
THEORY:Convolution is a formal mathematical operation, just as multiplication, addition, and
integration. Addition takes twonumbers and produces a thirdnumber, while convolution takestwosignals and produces a thirdsignal. Convolution is used in the mathematics of many fields,
such as probability and statistics. In linear systems, convolution is used to describe therelationship between three signals of interest: the input signal, the impulse response, and the
output signal.
In this equation, x1(k), x2(n-k) and y(n) represent the input to and output from the system
at time n. Here we could see that one of the input is shifted in time by a value every time it ismultiplied with the other input signal. Linear Convolution is quite often used as a method of
implementing filters of various types.
ALGORITHM:
1. Enter the input Sequence ,x having length=42. Enter the Impulse Sequence, h having length=4
3. Performing the Convolution, store the value in y4. Plotting the Input Sequence.5. Plotting the Impulse Sequence.6. Plotting the Output Sequence.
PROGRAM:
%linear convolution programclc;
clear all;close all;
disp('linear convolution program');x=input('enter i/p x(n):');
m=length(x);h=input('enter i/p h(n):');
n=length(h);x=[x,zeros(1,n)];
subplot(2,2,1), stem(x);
-
8/2/2019 66667106-Lab-Manual
11/38
11
title('i/p sequencce x(n)is:');xlabel('---->n');
ylabel('---->x(n)');grid;h=[h,zeros(1,m)];
subplot(2,2,2), stem(h);
title('i/p sequencce h(n)is:');xlabel('---->n');ylabel('---->h(n)');grid;
disp('convolution of x(n) & h(n) is y(n):');y=zeros(1,m+n-1);
for i=1:m+n-1y(i)=0;
for j=1:m+n-1if(j
-
8/2/2019 66667106-Lab-Manual
12/38
12
%program for discrete Correlation
x=[1 2 3 4];
y=[2 3 4 5];z=xcorr(x,y);stem(z);
subplot(2,2,1),stem(x)title(input sequence 1)
subplot(2,2,2),stem(y)title(input sequence 2)
subplot(2,2,3),stem(z)title(output sequence)
ALGORITHM:
1 Enter the input Sequence ,x having length=4
2 Enter the Impulse Sequence, y having length=43 Performing the Correlation, store the value in y
4 Plotting the Output Sequence ,store in z.
RESULT:
1 2 3 40
1
2
3
4input sequence 1
1 2 3 40
2
4
6input sequence 2
0 2 4 6 80
10
20
30
40output sequence
-
8/2/2019 66667106-Lab-Manual
13/38
13
CIRCULAR CONVOLUTION
AIM: To verify Circular Convolution.
EQUIPMENTS:Software - MATLAB 7.5
THEORY:
Circular convolution is another way of finding the convolution sum of two input signals.It resembles the linear convolution, except that the sample values of one of the input signals is
folded and right shifted before the convolution sum is found. Also note that circular convolutioncould also be found by taking the DFT of the two input signals and finding the product of the
two frequency domain signals. The Inverse DFT of the product would give the output of thesignal in the time domain which is the circular convolution output. The two input signals could
have been of varying sample lengths. But we take the DFT of higher point, which ever signalslevels to. For eg. If one of the signal is of length 256 and the other spans 51 samples, then we
could only take 256 point DFT. So the output of IDFT would be containing 256 samples insteadof 306 samples, which follows N1+N2 1 where N1 & N2 are the lengths 256 and 51
respectively of the two inputs. Thus the output which should have been 306 samples long isfitted into 256 samples. The 256 points end up being a distorted version of the correct signal.
This process is called circular convolution.
PROGRAM:
%circular convolution programclc;clear all;close all;disp('circular convolution program');x=input('enter i/p x(n):');m=length(x);h=input('enter i/p sequence h(n)');n=length(h);subplot(2,2,1), stem(x);title('i/p sequencce x(n)is:');xlabel('---->n');ylabel('---->x(n)');grid;subplot(2,2,2), stem(h);title('i/p sequencce h(n)is:');
xlabel('---->n');ylabel('---->h(n)');grid;disp('circular convolution of x(n) & h(n) is y(n):');if(m-n~=0)
if(m>n)h=[h,zeros(1,m-n)];n=m;
end
-
8/2/2019 66667106-Lab-Manual
14/38
14
x=[x,zeros(1,n-m)];m=n;
endy=zeros(1,n);y(1)=0;a(1)=h(1);for j=2:n
a(j)=h(n-j+2);end
%ciruclar convfor i=1:n
y(1)=y(1)+x(i)*a(i);end
for k=2:ny(k)=0;
% circular shiftfor j=2:n
x2(j)=a(j-1);endx2(1)=a(n);
for i=1:nif(i
-
8/2/2019 66667106-Lab-Manual
15/38
15
DFT AND IDFTAIM: To develop a program for Computing DFT and IDFT in MATLAB
REQUIREMENTS: MATLAB 7.5
THEORY:The discrete Fourier transform (DFT) X[k] of a finite-length sequence x[n] can be easily
computed in MATLAB using the function fft. There are two versions of this function. fft(x)computes the DFTX[k] of the sequencex[n] where the length ofX[k] is the same as that ofx[n].
fft(x,L) computes the L-point DFT of a sequence x[n] of lengthNwhereL N. IfL > N, x[n] iszero-padded with LN trailing zero-valued samples before the DFT is computed. The inverse
discrete Fourier transform (IDFT) x[n] of a DFT sequenceX[k] can likewise be computed usingthe function ifft, which also has two versions.
PROGRAM CODE:
% Program to perform Discrete Fourier Transform
clc;clear all; close all hidden;x=input('The given sequence is x(n): ');
N=length(x);
for k=1:N
X(k)=0;
for n=1:N
X(k)=X(k)+x(n).*exp(-j.*2.*pi.*(n-1).*(k-1)./N);
end
-
8/2/2019 66667106-Lab-Manual
16/38
16
end
display('The DFT of the given sequence is:')
X
p=0:(N-1);
stem(p,abs(X)),grid
Input Sequence:-
ALGORITHM:
1 Enter the input Sequence ,x having length=4
2 Set the range of k according to the length of x.3 Computing DFT, store the value in X(k).4 Plotting the DFT of given Sequence,store in X(k).
RESULT:
0 0.5 1 1.5 2 2.5 30
2
4
6
8
10
12
14
16
18
20
Fig shows DFT of input sequence
% Program to perform Inverse Discrete Fourier Transform
clc;clear all; close all hidden;
x=input('The given sequence is x(n): ');
N=length(x);
for k=1:N
X(k)=0;
for n=1:N
-
8/2/2019 66667106-Lab-Manual
17/38
17
X(k)=X(k)+x(n).*exp(j.*2.*pi.*(n-1).*(k-1)./N);
end
end
display('The DFT of the given sequence is:')
X
p=0:(N-1);
stem(p,abs(X)),grid
Input Sequence:
ALGORITHM:
1 Enter the input Sequence, x having length=42 Set the range of k according to the length of x.
3 Computing IDFT, store the value in X(k).4 Plotting the IDFT of given Sequence, store in X(k).
RESULT:
0 0.5 1 1.5 2 2.5 30
1
2
3
4
5
6
7
8
9
10
Fig shows IDFT of input sequence
-
8/2/2019 66667106-Lab-Manual
18/38
18
INVERSE Z TRANSFORM
AIM: To develop a program for Computing Inverse Z-Transform
EQUIPMENTS: MATLAB 7.5
THEORY:Description: In mathematics and signal processing, the Z-transform converts a discrete
time-domain signal, which is a sequence of real or complex numbers, into a complex frequency-
domain representation. The Z-transform, like many other integral transforms, can be defined aseither a one-sided or two-sided transform.
The bilateral or two-sided Z-transform of a discrete-time signal x[n] is the function X(z)
defined as
.
Alternatively, in cases where x[n] is defined only for n 0, the single-sided or unilateral
Z-transform is defined as
In signal processing, this definition is used when the signal is causal.
Rational Z-transform to partial fraction form:Consider the transfer function in the rational form i-e;
http://en.wikipedia.org/wiki/Signal_processinghttp://en.wikipedia.org/wiki/Causal_systemhttp://en.wikipedia.org/wiki/Causal_systemhttp://en.wikipedia.org/wiki/Signal_processing -
8/2/2019 66667106-Lab-Manual
19/38
19
18z3
G(z)= ------------------
18z3+3z
2-4z-1
We can evaluate the partial fraction form of the above system using matlab command. The
partial fraction form be,
G(z)= 0.36__ + __0.24__ + _0.4____10.5z-1
1+0.33 z-1
(1+0.33 z-1
)
Matlab command that converts rational z-transform in to partial fraction form is
residuez.If you want to see the poles and zeros in a zplane. This function displays the poles and zeros
of discrete-time systems. Use the under given matlab command
zplane(b,a)
PROGRAM CODE:
%program to perform Inverse Z-Transform
b=[1,0.4*sqrt(2)];
a=[1,-0.8*sqrt(2),0.64];[R,P,C]=residuez(b,a);
m=abs(P');
subplot(1,2,1);
plot(m);
title('magnitude');
A=angle(P')/pi;
subplot(1,2,2);
plot(A);
title('Angle');
freqz(a,b,10)
ALGORITHM:
1. Write the poles and zeros of the input sequence.2. Returned vector R contains the residues,Column vector contains P contains the pole
locations. And row vector contains the direct terms.3. Plot the pole magnitudes.4. Plot the pole angles in pi units.5. Plot the frequency response of given z-transform of the given function.
Input Sequence:
RESULT: MAGNITUDE AND ANGLE:-
-
8/2/2019 66667106-Lab-Manual
20/38
20
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
50
100
150
Normalized Frequency ( rad/sample)
Phase(degrees)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-20
-10
0
10
20
Normalized Frequency ( rad/sample)
Ma
gnitude(dB)
1 1.5 2-0.5
0
0.5
1
1.5
2magnitude
1 1.5 2-0.25
-0.2
-0.15
-0.1
-0.05
0
0.05
0.1
0.15
0.2
0.25Angle
Experiment no 6AIM : To design and implement on a breadboard a circuit to perform Amplitude modulation.
APPARATUS: Two IC BC 107BP,33k, 100k,two 4.7k,270ohm resistor, two 4.7F capacitor,CRO(20 Mhz),Function generator(1Mhz),connecting wires and probes.
-
8/2/2019 66667106-Lab-Manual
21/38
21
PROCEDURE:-1. Connect the circuit as per the given circuit diagram.
2. Apply fixed frequency carrier signal to carrier input terminals.3. Apply modulating signal from function generator of 1VP-P of 500Hz.
4. Note down and trace the modulated signal envelop on the CRO screen. 5. Find the modulationindex by measuring Vmax and Vmin from the modulated (detected/ traced) envelope.
M=(VmaxVmin)/(Vmax+Vmin)6. Repeat the steps 3,4 & 5 by changing the frequency or/& amplitude of the modulating signal
so as to observe over modulation, under modulating and perfect modulation.7. For demodulation, apply the modulated signal (A.M) as an input to the demodulator and verify
the demodulated output with respect to the applied modulating signals and their respectiveoutputs.
-
8/2/2019 66667106-Lab-Manual
22/38
22
Observed m= (Vmax + V min) / (V maxV min )
-
8/2/2019 66667106-Lab-Manual
23/38
23
ERROR ANALYSIS: Calculate Modulation index using mathematical formula mc = Vm/Vc.
%AGE ERROR = ((mmc)/ mc)x100% RESULT:
-
8/2/2019 66667106-Lab-Manual
24/38
24
Experiment no 7
AIM : To design and implement on a breadboard a circuit to perform Frequency modulation.
APPARATUS: IC LM 2206,10k, two 100k,three 4.7k,220ohm resistor,22F,1F,10F,0.01F,CRO(20 Mhz),Function generator(1Mhz),connecting wires and probes. CIRCUIT DIAGRAM:
1. Connect the circuit as per the given circuit diagram.2. 2. Apply the modulating signal of 500HZ with 1Vp-p.3. Trace the modulated wave on the C.R.O & plot the same on graph.4. Find the modulation index by measuring minimum and maximum frequency deviations
from the carrier frequency using the CRO. M = S/f = maximum Frequency deviation /
modulating signal frequency5. Repeat the steps 3& 4 by changing the amplitude and /or frequency of the modulatingSignal.
EXPECTED WAVEFORMS
-
8/2/2019 66667106-Lab-Manual
25/38
25
OBSERVATION TABLEFormula used: m f= / fm
where = k Vm fcK is the proportionality constant
-
8/2/2019 66667106-Lab-Manual
26/38
-
8/2/2019 66667106-Lab-Manual
27/38
27
Result
Experiment no.-8AIM: Compile, Elaborate, and Simulate a 2-to-1 mux Design using Incisive Simulator.
Equipment: CADENCEIncisive SimulatorTheory: Incisive Simulator is created for verification teams developing complex system-level
environments, Cadence Incisive Enterprise Simulator simplifies and accelerates yourworkflow. Its blend of leading-edge process automation technology, high-performance engines,
power analysis, and advanced debug capabilitiesintegrated with the Incisive platformhelpsyou verify the most complex chips and systems. With support for all IEEE-standard languages,
Si2s Common Power Format, and the comprehensive Plan-to-Closure Methodology, IncisiveEnterprise Simulator improves productivity, project predictability, and product quality, helping
you take the risk out of verification.
Flow Chart:
INCISIVE ENTERPRISE SIMULATOR: Incisive Enterprise Simulator is the only product onthe market that supports all IEEE-standard languages and design abstractions, from the gate levelall the way up to system modeling and verification. Additionally it supports the verification plan
(v-Plan) executable specification, Si2s Common Power Format (CPF) specification, and allPlan-to-Closure Methodology flows. Verification engineers can extend the functionality of
Enterprise Simulator with Incisive Software Extensions that provide a high-throughput channelbetween the test-bench and the device under test (DUT), and enables automated Plan-to-Closure
verification of embedded software exactly as if it were another part of the DUT. With otherelements from the Incisive platform, including verification IP, hardware acceleration and
emulation, analog/mixed-signal/RF verification, and formal assertion verification, EnterpriseSimulator supports any test-bench, HDL, CPF file, software, and assertion IP created with the
Incisive platforms other simulators: the HDL Simulator and the Design Team Simulator; or v-Plans created by Enterprise Manager.
-
8/2/2019 66667106-Lab-Manual
28/38
28
Experiment -8AIM Interfacing 8x8 keyboard using 8085 microprocessor.
Apparatus required Push Switches (64)SAMPLE PROGRAM:
Block Diagram
-
8/2/2019 66667106-Lab-Manual
29/38
29
Source program
MVI A, 90H : Initialize Port A as input andOUT CR : Port B as Output
START: MVI A, 00 : Make all scan lines zero
OUT PB
BACK: IN PA
CPI FF : Check for key release
JNZ BACK : If not, wait for key release
CALL DELAY : Wait for key debounce
BACK 1: IN PA
CPI FF : Check for key press
JZ BACK 1 : If not, wait for key pressCALL DELAY : Wait for key debounce
MVI L, 00H : Initialize key counter
MVI C, 08H
MVI B, FEH : Make one column low
NEXTCOL: MOV A, B
-
8/2/2019 66667106-Lab-Manual
30/38
30
OUT PB
MVI D, 08H : Initialize row counter
IN PA : Read return line status
NEXTROW: RRC : Check for one row
JNC DISPLAY : If zero, goto display else continue
INR L : Increment key counterDCR D : Decrement row counter
JNZ NEXTROW : Check for next row
MOV A, B
RLC : Select the next column
MOV B, A
DCR C : Decrement column count
JNZ NEXTCOL : Check for last column if not repeat
JMP START : Go to start
INTERFACING SCHEME
Delay subroutine:
Delay: LXI D, Count
Back: DCX D
MOV A, D
ORA E
JNZ Back
RET
FLOWCHART
-
8/2/2019 66667106-Lab-Manual
31/38
31
Conclusion A stepper motor is a digital motor. It can be driven by digital signal. Fig. shows thetypical 2 phase motor rated 12V /0.67 A/ph interfaced with the 8085 microprocessor system
using 8255. Motor shown in the circuit has two phases, with center-tap winding. The center tapsof these windings are connected to the 12V supply. Due to this, motor can be excited by
grounding four terminals of the two windings. Motor can be rotated in steps by giving proper
excitation sequence to these windings. The lower nibble of port A of the 8255 is used to generateexcitation signals in the proper sequence. These excitation signals are buffered using drivertransistors. The transistors are selected such that they can source rated current for the
windings.Motor is rotated by 1.80 per excitation.____________________________________________________________________________
Experiment 9AIM Generation of delay in binary counting using 8085 microprocessor .SAMPLE PROGRAM Write a program for displaying binary up counter. Counter should count
numbers from 00 to FFH and it should increment after every 0.5 sec.
Source Program:
LXI SP, 27FFH : Initialize stack pointerMVI C, OOH : Initialize counter
BACK: CALL Display : Call display subroutineCALL Delay : Call delay subroutine
INR C : Increment counterMOV A, C CPI OOH : Check counter is > FFH
JNZ BACK : If not, repeatHLT : Stop
Delay Subroutine:
-
8/2/2019 66667106-Lab-Manual
32/38
32
Delay: LXI B, count : Initialize countBACK: DCX D : Decrement count
MOV A, EORA D : Logically OR D and E
JNZ BACK : If result is not 0 repeat RET : Return to main program
Experiment 10
AIM: TO implement a moving 7-segment display with suitable delay using 8085 microprocessor.
Apparatus required 7-segment display
Sample program Interface an 8-digit 7 segment LED display using 8255 to the 8085microprocessor system and write an 8085 assembly language routine to display message on thedisplay.
INTERFACING SCHEME
-
8/2/2019 66667106-Lab-Manual
33/38
33
-
8/2/2019 66667106-Lab-Manual
34/38
34
CONCLUSIONFig. shows the multiplexed eight 7-segment display connected in the 8085 system using 8255. In
this circuit port A and port B are used as simple latched output ports. Port A provides the
-
8/2/2019 66667106-Lab-Manual
35/38
-
8/2/2019 66667106-Lab-Manual
36/38
36
Experiment 11Aim:Write a program to interface two digit numbers using seven Segment LEDs, use 8086microprocessor and 8255 PPI
Apparatus required 7-segment display
Flow Chart
-
8/2/2019 66667106-Lab-Manual
37/38
37
Circuit Diagram
-
8/2/2019 66667106-Lab-Manual
38/38
Conclusion
Fig. shows the interfacing of eight 7-segment digits to 8085 through 8279. As shown in
the figure eight display lines (Bo-B3 and Ao-A3) are buffered with the help of transistor
and used to drive display digits. These buffered lines are connected in parallel to all
display digits. So, Sl and S2 lines are decoded and decoded lines are used for selection
of one of the eight digits
Source program:
LXI B, 6200B : Initialize lookup table pointer
MVI C, 08H : Initialize counter
MVI A, 00H : Initialize keyboard/display
OUT 8IH : Mode
MVI A, 3EH : Initialize prescaler count
OUT 8IH
MVI A, 90H : Initial size 8279 in write Display
OUT 8IH : RAM-mode
BACK : MOV A, M : Get the 7-segment code
OUT 80H : Write 7-segment code in display RAM
INX H : Increment lookup table pointer
DCR C : Decrement counter
JNZ BACK : if count = 0 stop, otherwise go to back
HLT : Stop program execution