You are on page 1of 61

ANALOG and DIGITAL ELECTRONICS

LAB MANUAL
[17CSL37]
Prepared By,
Mrs. MANASA C M
Assistant Professor
Department of CSE
MSEC

Department of Computer Science and Engineering


M.S Engineering College
(NAAC Accredited and an ISO 9001:2015 Certified Institution)
(Affiliated to Visvesvaraya Technological University Belgaum and approved by AICTE, New Delhi)
NAVARATHNA AGRAHARA, SADAHALLI POST, BANGALORE- 562 110, Tel: 080-3252 9939, 3252 957
ADE LAB 15CSL37

List of Experiments

Hours/Week: 03 Exam Hours: 03


I.A. Marks: 20 Total Hours: 50
Semester: 3 Exam Marks: 80

Sl Experiment Page
No. No.
1. a. Design and construct a Schmitt trigger using Op-Amp for given UTP 1
and LTP values and demonstrate its working.
b. Design and implement a Schmitt trigger using Op-Amp using a
simulation package for two sets of UTP and LTP values and 3
demonstrate its working.
2. a. Design and construct a rectangular waveform generator (Op-Amp 5
relaxation oscillator) for given frequency.
b. Design and implement a rectangular waveform generator (Op-Amp
relaxation oscillator) using a simulation package and observe the
change in frequency when all resistor values are doubled. 7
3. Design and implement an astable multivibrator circuit using 555 timer 9
for a given frequency and duty cycle.
4. Design and implement Half adder, Full Adder, Half Subtractor, Full 12
Subtractor using basic gates.
5. a. Given any 4-variable logic expression, simplify using Entered 16
Variable Map and realize the simplified logic expression using 8:1
multiplexer IC.
b. Write the Verilog /VHDL code for an 8:1 multiplexer. Simulate 18
and verify its working.
6. a) Design and implement code converter I) Binary to Gray II) Gray to 20
Binary Code using basic gates.
7. Design and verify the Truth Table of 3-bit Parity Generator and 4-bit 25
Parity Checker using basic logic gates with an even parity bit.
8. a. Realize a J-K Master/Slave Flip-Flop using NAND gates and verify 29
its truth table.
b. Write the Verilog/VHDL code for D Flip-Flop with positive-edge
triggering. Simulate and verify its working. 31
9. a. Design and implement a mod-n (n<8) synchronous up counter 33
using J-K Flip-Flop ICs & demonstrate its working.
b. Write the Verilog /VHDL code for mod-8 up counter. Simulate and
verify its working 37
10. Design and implement an asynchronous counter using decade counter 39
IC to count up from 0 to n (n<=9) and demonstrate on 7 segment
display (using IC 7447).
11. Generate a Ramp output waveform using DAC0800 (Inputs are given 42
to DAC through IC74393 dual 4-bit binary counter).
12. Study experiment: To study 4-bitALU using IC-74181. 45

Department of CSE, MSEC Page 1


ADE LAB 15CSL37

Instructions:
1. All laboratory experiments (1 to 11 nos) are to be included for practical examination.
2. Students are allowed to pick one experiment from the lot.
3. Strictly follow the instructions as printed on the cover page of answer script.
4. Marks distribution: a ) For questions having part a only- Procedure + Conduction +
Viva:20 + 50 +10 =80 Marks
b ) For questions having part a and b Part a- Procedure + Conduction + Viva:10 + 35
+05= 50 Marks Part b- Procedure + Conduction + Viva:10 + 15 +05= 30 Marks
5. Change of experiment is allowed only once and marks allotted to the procedure part to
be made zero.
Objectives: This laboratory course enables students to get practical experience in design,
assembly and evaluation/testing of
1. Analog components and circuits including Operational Amplifier, Timer, etc.
2. Combinational logic circuits.
3. Flip - Flops and their operations .
4. Counters and Registers using Flip-flops.
5. Synchronous and Asynchronous Sequential Circuits.
6. A/D and D/A Converters.
Course outcomes: On the completion of this laboratory course, the students will be able to:
1. Use various Electronic Devices like Cathode ray Oscilloscope, Signal
generators, Digital Trainer Kit, Multimeters and components like Resistors,
Capacitors, Op amp and Integrated Circuit.
2. Design and demonstrate various combinational logic circuits.
3. Design and demonstrate various types of counters and Registers using Flip-
flops
4. Use simulation package to design circuits.
5. Understand the working and implementation of ALU.

Department of CSE, MSEC Page 3


ADE LAB 15CSL37

Experiment No.1a: To design and implement a Schmitt trigger using Op-Amp for
given UTP and LTP values & demonstrate its working.

Description:
Schmitt Trigger converts an irregular shaped waveform to a square wave or pulse. Here,
the input voltage triggers the output voltage every time it exceeds certain voltage levels
called the upper threshold voltage UTP and lower threshold voltage LTP. The input
voltage is applied to the inverting input. Because the feedback voltage is aiding the input
voltage, the feedback is positive. A comparator using positive feedback is usually called
a Schmitt Trigger. Schmitt Trigger is used as a squaring circuit, in digital circuitry,
amplitude comparator, etc.
Open loop gain of op amp is very high (ideally infinite).Any small difference between
VNI and VINV results into saturation of output voltage ±VSAT .Value of VSAT is limited by
the supply voltage of op amp.

Components Required:
Op amp IC µA 741, Resistor of 10KΩ, 110KΩ, DC regulated power Supply, trainer kit
(+12v & -12v is given to Op amp from this),Signal generator, CRO.

Design:
From theory of Schmitt trigger circuit using op-amp, we have the trip points
UTP= R2*Vref / (R1+R2) + R1*Vsat/(R1+R2)
LTP= R2*Vref / (R1+R2) - R1*Vsat/(R1+R2)

Where Vsat is the positive saturation of the opamp=90% of vcc


Hence given the LTP and UTP values to find the R1, R2 & Vref values the following
design is used
UTP + LTP= 2R2*Vref / (R1+R2)-------(1)
UTP – LTP = 2R1*Vsat/(R1+R2)--------(2)
Let Vsat=12v, UTP=4v and LTP =2v then eq(2) yields R2=11R1
From Eq(1) we have Vref=(UTP+LTP)(R1+R2) / 2R2= 3.27v

Let R1=10k then R2= 110k

Circuit Diagram for Schmitt Trigger

Department of CSE, MSEC Page 1


ADE LAB 15CSL37

Result waveform

Hysteresis curve

CRO in X-Y mode showing the Hysteresis curve

Department of CSE, MSEC Page 2


ADE LAB 15CSL37

Experiment No.1b: To implement a Schmitt trigger using Op-Amp using a


simulation package for two sets of UTP and LTP values & demonstrate its working.

Components to be placed in the schematic:


IC uA 741, Resistor of 10KΩ, 110KΩ, DC regulated power supply, Signal generator,
CRO

Type of analysis: TIME DOMAIN (TRANSIENT) Run to time: 100msec


step size: 0.1msec

UTP=4v LTP=2v Vref=3.3v

Department of CSE, MSEC Page 3


ADE LAB 15CSL37

Hysteresis Curve:
To get the Hysteresis curve
1. Choose Axis settings from Plot menu
2. Under X-axis select axis variable
3. Select the input wave
4. Click Apply and ok
5. From the output check the UTP and LTP values
6. When Vin >UTP The o/p changes from +vsat(10v) to –vsat(-10v)
7. When vin< LTP the o/p changes from -vsat(10v) to +vsat(-10v)

10V

5V

0V If UTP= 1V and LTP=-


3V then Vref= -2.2v
-5V

-10V
-5.0V -4.0V -3.0V -2.0V -1.0V 0.0V 1.0V 2.0V 3.0V 4.0V 5.0V
V(V1:+) V(U1:OUT)
V(V1:+)

10V

5V

For UTP=-1V LTP=-3V


0V then Vref=-2.2v

-5V

-10V
0s 5ms 1 0m s 1 5m s 2 0m s 2 5m s 3 0m s 3 5m s
4 0m s V (V 1: +) V(U1:OUT)
Time

Hysteresis Curve

Department of CSE, MSEC Page 4


ADE LAB 15CSL37

Experiment No.2a: Design and construct a rectangular waveform generator (op-amp


relaxation Oscillator) for given frequency and demonstrate its working

Description:

Op-Amp Relaxation Oscillator is a simple Square wave generator which is also called as
a Free running oscillator or Astable multivibrator or Relaxation oscillator. In this figure
the op-amp operates in the saturation region. Here, a fraction (R1/ (R1+R2)) of output
is fed back to the noninverting input terminal. Thus reference voltage is (R1/ (R1+R2))
Vo. And may take values as + (R1/ (R1+R2)) Vsat or - (R1/ (R1+R2)) Vsat. The output
is also fed back to the inverting input terminal after integrating by means of a low-pass
RC combination. Thus whenever the voltage at inverting input terminal just exceeds
reference voltage, switching takes place resulting in a square wave output.

Components Required:
Op-amp μA 741, Resistor of 10KΩ,4.7KΩ, Capacitor of 0.1 μF, digital trainer kit
(+12v & -12v is given to Op amp from this), CRO.

Circuit Diagram

Design:
The period of the output rectangular wave is given as T =2RC ln (1+β/1- β )-------- 1
Where,
β =R1/R1+ R2 is the feedback fraction
If R1 = R2, then from equation (1) we have T = 2RC ln(3) ------- 2
Design for a frequency of 1 kHz (implies T =1ms )
Let C=0.1μF

Then calculating R as R=T/2 Cln(3) =1*10-3/2*0.1*10-6 * 1.099 = 5*103 = 5K


Select R=4.7KΩ

Department of CSE, MSEC Page 5


ADE LAB 15CSL37

The voltage across the capacitor has a peak voltage of Vc =(R1/R1+ R2) Vsat

Department of CSE, MSEC Page 6


ADE LAB 15CSL37

Procedure:
1. Before making the connections check all the components using multimeter.
2. Make the connections as shown in figure and switch on the power supply.
2. Observe the voltage waveform across the capacitor on CRO.
3. Also observe the output waveform on CRO. Measure its amplitude and frequency.

Waveforms

Result:

The frequency of the oscillations = Hz.

Department of CSE, MSEC Page 7


ADE LAB 15CSL37

Experiment No.2b: To implement a rectangular waveform generator (Op-Amp


relaxation oscillator) using a simulation package and observe the change in
frequency when all resistor values are doubled.

Waveforms from simulation T= 1ms f=1khz

20V

10V

0V

-10V

-20V
0s 5ms 10ms 15ms 20ms 25ms 30ms 35ms 40ms
V (C1 :2 ) V (R3 :2 )
Time

Type of analysis: TIME DOMAIN (TRANSIENT)


Run to time: 10ms
Step size: 0.01ms

Department of CSE, MSEC Page 8


ADE LAB 15CSL37

Waveforms with resistor values doubled

20V

10V

0V

-10V

-20V
0s 5ms 10ms 15ms 20ms 25ms 30ms 35ms 40ms
V(C 1: 2) V(R 3: 2)
Time

T=2ms = frequency =500hz

Department of CSE, MSEC Page 9


Experiment No.3: To design and implement an astable multivibrator using 555
Timer for a given frequency and duty cycle.

Description:
Multivibrator is a form of oscillator, which has a non-sinusoidal output. The output
waveform is rectangular. The multivibrators are classified as

i) Astable or free running multivibrator It alternates automatically between two


states (low and high for a rectangular output) and remains in each state for a time
dependent upon the circuit constants. It is just an oscillator as it requires no external
pulse for its operation.

ii)Monostable or one shot multivibrators: It has one stable state and one quasi stable.
The application of an input pulse triggers the circuit time constants and the output goes
to the quazi stable state, after a period of time determined by the time constant, the
circuit returns to its initial stable state. The process is repeated upon the application of
each trigger pulse.

iii)Bistable Multivibrators: It has both stable states. It requires the application of an


external triggering pulse to change the output from one state to other. After the output
has changed its state, it remains in that state until the application of next trigger pulse.
Flip flop is an example.

Components Required:
555 Timer IC, Resistors of 3.3KΩ, 6.8KΩ, Capacitors of 0.1 μF, 0.01 μF, digital trainer
kit(used to give +5v power supply to 555 IC),CRO.

Design:
Frequency = 1 kHz and duty cycle =75%, RA = 7.2kΩ & RB =3.6kΩ,
Duty cycle = tH / T = 0.75. Hence tH = 0.75T = 0.75ms and tL = T – tH = 0.25ms.
Let C=0.1μF and substituting in the above equations,
So RB= tL/0.693 x C =0.25 x 10-3/0.693 x .1x10-6=3.6kΩ
RA = (tH - 0.693 x RB x C) /0.693 x C
= 0.75 x 10-3 x 0.693 x 3.6 x 103 x 0.1x 10-6 / 0.693 x .1x10-6=7.2kΩ
Choose RA = 6.8kΩ and RB = 3.3kΩ.

Note:
The duty cycle determined by RA & RB can vary only between 50 & 100%. If RA is
much smaller than RB, the duty cycle approaches 50%.

Circuit Diagram:

Department of CSE, MSEC Page 10


Connect the pin 2 to the CRO to get the capacitor waveform check the amplitude from
the waveform to get the UTP and LTP values.
Connect pin 3 to CRO to get the output. Find out the TH and TL values.
Procedure:
1. Before making the connections, check the components using multimeter.
2. Make the connections as shown in figure and switch on the power supply.
3. Observe the capacitor voltage waveform at 6th pin of 555 timer on CRO.
4. Observe the output waveform at 3rd pin of 555 timer on CRO (shown below).
5. Note down the amplitude levels, time period and hence calculate duty cycle.
Example:
Given frequency (f) = 1KHz and duty cycle = 60% (=0.6)
The time period T =1/f = 1ms = tH + tL
Where tH is the time the output is high and tL is the time the output is low.
For an astable multivibrator using 555 Timer we have
tL = 0.693 RB C ------(1)
tH = 0.693 (RA + RB)C ------(2)
T = tH + tL = 0.693 (RA +2 RB) C
Duty cycle = tH / T = 0.6. Hence tH = 0.6 T = 0.6ms and tL = T – tH = 0.4ms.
Let C=0.1μF and substituting in the above equations,
So RB= tL/0.693 x C =0.4 x 10-3/0.693 x .1x10-6=5.8kΩ
RA = tH - 0.693 x Cx RB / 0.693 x C
=0.6 x 10-3 x0.693 x5.8 x 103 0.1x x10-6/0.693 x .1x10-6=2.9kΩ
RB = 5.8KΩ (from equation 1) and RA = 2.9KΩ (from equation 2 & RB values).
The Vcc determines the upper and lower threshold voltages (observed from the
2 1
capacitor voltage waveform) as VUT = VCC VLT = VCC .
3 3

Result:
The frequency of the oscillations = 1KHz.

Waveforms

Department of CSE, MSEC Page 11


Department of CSE, MSEC Page 12
Result:

Threshold voltage VUT VLT


theoretical (2/3 x Vcc)=3.3V (1/3 x Vcc)=1.6V
practical

Note:
Each division in oscilloscope is 0.2
Time=no of div in x-axis x time base
Amplitude= no of div in y-axis x volt/div
Duty cycle= (Ton/Ton +Toff) *100

Duty cycle Duty cycle Ton Toff


Theoretical 75% 0.75ms 0.25ms
Practical

Department of CSE, MSEC Page 11


Experiment No 4. Design and implement Half adder, Full Adder, Half Subtractor,
Full Subtractor using basic gates.

Description:
Half-Adder: A combinational logic circuit that performs the addition of two data bits, A
and B, is called a half-adder. Addition will result in two output bits; one of which is the
sum bit, S, and the other is the carry bit, C. The Boolean functions describing the half-
adder are:
Sum = �⊕ � Cout = A B
Full-Adder: The half-adder does not take the carry bit from its previous stage into
account. This carry bit from its previous stage is called carry-in bit. A combinational logic
circuit that adds two data bits, A and B, and a carry-in bit, Cin , is called a full-adder. The
Boolean functions describing the full-adder are:

Sum = �⊕ � �𝑖� Cout = AB + Cin (�⊕ �)


Half Subtractor: Subtracting a single-bit binary value B from another A (i.e. A -B )
produces a difference bit D and a borrow out bit B-out. This operation is called half
subtraction and the circuit to realize it is called a half subtractor. The Boolean functions
describing the half- Subtractor are:
D = �⊕ � Bout = A‟ B
Full Subtractor: Subtracting two single-bit binary values, B, Cin from a single-bit value
A produces a difference bit D and a borrow out Br bit. This is called full subtraction. The
Boolean functions describing the full-subtracter are:

D = �⊕ � �𝑖� Br= A‟B + A‟(Cin) + B(Cin)


Components required:

IC 7400, IC 7408, IC 7486, IC 7432, Patch Cords & IC Trainer Kit.

I) TO REALIZE HALF ADDER

TRUTH TABLE
BOOLEAN EXPRESSIONS:
INPUTS OUTPUTS S=AB+ AB=A ⊕ B
A B S C C=A B

0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1

Department of CSE, MSEC Page 12


Circuit diagram:

II) FULL ADDER

TRUTH TABLE:
INPUTS OUTPUTS
A B Cin S C
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1

BOOLEAN EXPRESSIONS:
S= A ⊕ B ⊕ C

C=A B + B Cin + A Cin

Circuit diagram:

Department of CSE, MSEC Page 13


III) HALF SUBTRACTOR

TRUTH TABLE BOOLEAN EXPRESSIONS:

INPUTS OUTPUTS D=A⊕ B


_
A B D Br Br = A B
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0

Circuit diagram:

IV) FULL SUBTRACTOR

TRUTH TABLE BOOLEAN EXPRESSIONS:


D= A ⊕ B ⊕ C
INPUTS OUTPUTS _ _

A B Cin D Br Br= A B + B Cin + A Cin


0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1

Department of CSE, MSEC Page 14


Circuit diagram:

Procedure:
1. Verify all components & patch chords whether they are in good condition or not.
2. Make connections as shown in the circuit diagram.
3. Give supply to the trainer kit.
4. Provide input data to circuit via switches
5. Verify truth table sequence & observe outputs.

Result:
The truth table of above circuits are verified.

Department of CSE, MSEC Page 15


Experiment No.5a: Given any 4-variable logic expression, simplify using Entered
Variable Map and realize the simplified logic expression using 8:1 multiplexer IC.

Description:
The term multiplex means “many to one”. A multiplexer (MUX) has n inputs. Each line
is used to shift digital data serially. There is a single output line. One of the data stored
in the n input line is transferred to the output based on the valued of control bits. An n
to 1 multiplexer requires m control bits where n<= 2m .
To construct an 4 variable function we require a 16(24) to 1 multiplexer, whereas using
an entered variable map method a 4 variable expression can be realized using 8(23) to 1
multiplexer
Components Used:
IC 74 LS151, patch chords, power chords, trainer kit.

Pin Diagrams: IC 74LS151

Entered variable map


Example:
Simplify the following function using EVM technique
f(a,b,c,d)=∑m(2,3,4,5,13,15)+dc(8,9,10,11)

MEV map
Decimal ABCD f Data
entry
0 0000 0
0 Do
1 0001 0
2 0010 1
1 D1
3 0011 1
4 0100 1
1 D2
5 0101 1
6 0110 0
0 D3
7 0111 0
8 1000 X
X D4
9 1001 X
10 1010 X
X D5
11 1011 X
12 1100 0
D D6
13 1101 1
14 1110 0
D D7
15 1111 1

Department of CSE, MSEC Page 16


Circuit Diagram

Procedure:
1. Verify all components & patch chords whether they are in good condition or not.
2. Make connections as shown in the circuit diagram.
3. Give supply to the trainer kit.
4. Provide input data to circuit via switches
5. Verify truth table sequence & observe outputs.

Result:
The truth table is verified

Department of CSE, MSEC Page 17


Experiment No.5b: Write the verilog /VHDL code for 8:1 MULTIPLEXER.
Simulate and verify its working.

Description:
An 8:1 multiplexer has 8 inputs and one
output. The data stored in one of these 8
input line is transferred serially to the
output based on the value of the selection
bits

Truth table:
INPUTS OUTPUTS
SEL (2) SEL (1) SEL (0) Zout
0 0 0 I(0)
0 0 1 I(1)
0 1 0 I(2)
0 1 1 I(3)
1 0 0 I(4)
1 0 1 I(5)
0 1 1 I(6)
1 1 1 I(7)

Algorithm for 8 to1 multiplexer:


Input/output
I is a one dimensional array of sixe 8
Sel is a one dimensional array of size 3
Zout is output
Method
If the value of sel is 000 zout = I[0]
If the value of sel is 001 zout = I[1]
If the value of sel is 010 zout = I[2]
If the value of sel is 011 zout = I[3]
If the value of sel is 100 zout = I[4]
If the value of sel is 101 zout = I[5]
If the value of sel is 110 zout = I[6]
Else the value of zout is I[7]

Department of CSE, MSEC Page 18


VHDL code for 8 to 1 MUX (behavioral modeling):
library IEEE;
use IEEE.STD_LOGIC_1164.ALL; // includes the standard library
entity mux1 is
Port ( I : in std_logic_vector(7 downto 0);
sel : in std_logic_vector(2 downto 0); //Input and output is declared as ports
zout : out std_logic);
end mux1;
architecture Behavioral of mux1 is
begin
zout<= I(0) when sel="000" else // Based on the value of selection the value of data
I(1) when sel="001" else //stored in the array I is stored in zout
I(2) when sel="010" else
I(3) when sel="011" else
I(4) when sel="100" else
I(5) when sel="101" else
I(6) when sel="110" else
I(7);
end Behavioral;

OUTPUT:

Department of CSE, MSEC Page 19


Experiment No 6. a) Design and implement code converter I) Binary to Gray II) Gray to
Binary Code using basic gates.

Description:
Gray Code is one of the most important codes. It is a non-weighted code which belongs
to a class of codes called minimum change codes. In this codes while traversing from one
step to another step only one bit in the code group changes. In case of Gray Code two
adjacent code numbers differs from each other by only one bit.
Binary to gray code conversion is a very simple process. There are several steps to do
this types of conversions.
Steps given below elaborate on the idea on this type of conversion.
(1) The M.S.B. of the gray code will be exactly equal to the first bit of the given binary
number.
(2) Now the second bit of the code will be exclusive-or of the first and second bit of the
given binary number, i.e if both the bits are same the result will be 0 and if they are
different the result will be 1.
(3) The third bit of gray code will be equal to the exclusive-or of the second and third
bit of the given binary number. Thus the Binary to gray code conversion goes on.
One example given below can make your idea clear on this type of conversion.

Gray code to binary conversion is again very simple and easy process. Following steps
can make your idea clear on this type of conversions.
(1) The M.S.B of the binary number will be equal to the M.S.B of the given gray code.
(2) Now if the second gray bit is 0 the second binary bit will be same as the previous or
the first bit. If the gray bit is 1 the second binary bit will alter. If it was 1 it will be 0 and
if it was 0 it will be 1.
(3) This step is continued for all the bits to do Gray code to binary conversion. One
example given below will make your idea clear.

Components required:
IC 7486, Patch Cords & digital trainer Kit.

Department of CSE, MSEC Page 20


I) BINARY TO GRAY CONVERSION

0 0 1 1
0 0 1 1
0 0 1 1
0 0 1 1

0 1 0 1
0 1 0 1
0 1 0 1
0 1 0 1

0 1 1 0
0 1 1 0
1 0 0 1
1 0 0 1

0 0 0 0
1 1 1 1
0 0 0 0
1 1 1 1

BOOLEAN EXPRESSIONS:
G3=B3
G2=B3 ⊕ B2
G1=B1 ⊕ B2
G0=B1 ⊕ B0

Circuit Diagram: BINARY TO GRAY CODE


Department of CSE, MSEC Page 21
Department of CSE, MSEC Page 22
TRUTH TABLE:

Department of CSE, MSEC Page 23


II) RAY TO BINARY CONVERSION

0 0 1 1
0 0 1 1
0 0 1 1
0 0 1 1 B3 = G3

0 1 0 1
0 1 0 1
0 1 0 1 B2=G3 ⊕ G2

0 1 0 1

0 1 0 1
0 1 0 1
B1=G3 ⊕ G2 ⊕ G1
1 0 1 0
1 0 1 0

0 1 0 1
1 0 1 0
0 1 0 1
1 0 1 0 B0=G3 ⊕ G2 ⊕ G1 ⊕ G0

BOOLEAN EXPRESSIONS:
B3=G3
B2=G3 ⊕ G2
B1=G3 ⊕ G2 ⊕ G1
B0=G3 ⊕ G2 ⊕ G1 ⊕ G0

Circuit Diagram: Gray to Binary

Department of CSE, MSEC Page 24


Department of CSE, MSEC Page 25
TRUTH TABLE:

PROCEDURE:
Check all the components for their working.
 Insert the appropriate IC into the IC base.
Make connections as shown in the circuit diagram.
 Verify the Truth Table and observe the outputs.

RESULT: Binary to gray code conversion and vice versa is realized using EX-OR gates

Department of CSE, MSEC Page 26


Experiment No 7. Design and verify the Truth Table of 3-bit Parity Generator and 4-
bit Parity Checker using basic Logic Gates with an even parity bit.

Description:
The parity generating technique is one of the most widely used error detection techniques
for the data transmission. In digital systems, when binary data is transmitted and
processed, data may be subjected to noise so that such noise can alter 0s (of data bits) to 1s
and 1s to 0s.
Hence, parity bit is added to the word containing data in order to make number of 1s
either even or odd. Thus it is used to detect errors , during the transmission of binary data.
The message containing the data bits along with parity bit is transmitted from transmitter
node to receiver node.
I) Parity Generator:
It is combinational circuit that accepts an n-1 bit stream data and generates the additional
bit that is to be transmitted with the bit stream. This additional or extra bit is termed as a
parity bit.
In even parity bit scheme, the parity bit is „0‟ if there are even number of 1s in the data
stream and the parity bit is „1‟ if there are odd number of 1s in the data stream.
Even Parity Generator
Let us assume that a 3-bit message is to be transmitted with an even parity bit. Let the
three inputs A, B and C are applied to the circuits and output bit is the parity bit P. The
total number of 1s must be even, to generate the even parity bit P.
II) Parity Checker
It is a logic circuit that checks for possible errors in the transmission. This circuit can be
an even parity checker or odd parity checker depending on the type of parity generated at
the transmission end. When this circuit is used as even parity checker, the number of input
bits must always be even.
When a parity error occurs, the „sum even‟ output goes low and „sum odd‟ output goes
high. If this logic circuit is used as an odd parity checker, the number of input bits should
be odd, but if an error occurs the „sum odd‟ output goes low and „sum even‟ output goes
high.
Even Parity Checker
Consider that three input message along with even parity bit is generated at the
transmitting end. These 4 bits are applied as input to the parity checker circuit which
checks the possibility of error on the data. Since the data is transmitted with even parity,
four bits received at circuit must have an even number of 1s.
If any error occurs, the received message consists of odd number of 1s. The output of the
parity checker is denoted by PEC (parity error check).

Components Required:
IC 7486, Patch Cords & Digital Trainer Kit.

Department of CSE, MSEC Page 27


I) PARITY GENERATOR:

TRUTH TABLE:

The K-map simplification for 3-bit message even parity generator is

From the above truth table, the simplified expression of the parity bit can be written as
Department of CSE, MSEC Page 28
To generate the even parity bit for a 4-bit data, three Ex-OR gates are required to add the 4-
bits and their sum will be the parity bit.

Circuit diagram: parity generator

II) PARITY CHECKER:

The below table shows the truth table for the even parity checker in which PEC = 1 if the
error occurs, i.e., the four bits received have odd number of 1s and PEC = 0 if no error
occurs, i.e., if the 4-bit message has even number of 1s.

Department of CSE, MSEC Page 29


The above truth table can be simplified using K-map as shown below.

Department of CSE, MSEC Page 30


The above logic expression for the even parity checker can be implemented by using three
Ex-OR gates as shown in figure. If the received message consists of five bits, then one
more Ex-OR gate is required for the even parity checking.

Circuit diagram:

PROCEDURE:
Check all the components for their working.
 Insert the appropriate IC into the IC base.
Make connections as shown in the circuit diagram.
 Verify the Truth Table and observe the outputs.

RESULT: 3 bit parity generator and 4 bit parity checker is verified.

Department of CSE, MSEC Page 31


Experiment No.8a: Realize a J-K Master/Slave FF using NAND gates and verify its
truth table

Description:
A flip-flop is a device very much like a latch in that it is a bistable multivibrator, having
two states and a feedback path that allows it to store a bit of information. The difference
between a latch and a flip-flop is that a latch is asynchronous, and the outputs can
change as soon as the inputs do (or at least after a small propagation delay). A flip-flop,
on the other hand, is edge-triggered and only changes state when a control signal goes
from high to low or low to high.

Master Slave Flip Flop:


The control inputs to a clocked flip flop will be making a transition at approximately the
same times as triggering edge of the clock input occurs. This can lead to unpredictable
triggering.
A JK master flip flop is positive edge triggered, whereas slave is negative edge
triggered. Therefore master first responds to J and K inputs and then slave. If J=0 and
K=1, master resets on arrival of positive clock edge. High output of the master drives
the K input of the slave.
For the trailing edge of the clock pulse the slave is forced to reset. If both the inputs are
high, it changes the state or toggles on the arrival of the positive clock edge and the
slave toggles on the negative clock edge. The slave does exactly what the master does.

Components used:
IC 74 LS00, IC 74LS10, patch chords, trainer kit.

Pin Diagrams:74LS10,74LS00

Department of CSE, MSEC Page 32


Truth table:

Clk J K Q Q bar comment


0 0 Q0 Q bar No change
0 1 0 1 Reset
1 0 1 0 Set
1 1 Q0 Q0 toggle

CIRCUIT DIAGRAM:

Procedure:
1. Verify all components & patch chords whether they are in good condition or
not.
2. Make connections as shown in the circuit diagram.
3. Give supply to the trainer kit.
4. Provide input data to circuit via switches.
5. Verify truth table sequence & observe outputs.

Conclusion:
Truth table is verified

Department of CSE, MSEC Page 33


Experiment No.8b: Write the verilog/ VHDL code for D Flip-Flop with positive- edge
triggering. Simulate and verify its working.

Description:
D- flip flop is a data flip flop the truth table summarizes the operation of the D – flip
flop. It has a single input D and two output Q and Q‟

Truth table:

clk D(input) Q(output) Q bar


- 0 No change
- 1 No change
0 0 1
1 1 0

Algorithm:
Clock and D is the input to the flip flop, Q and Qbar is the output of the system
For every positive transition of the clock
1. The value of D is stored in Q and the
2. The value of complement of D is stored in Qbar

VHDL code for D Flip Flop counter:


library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity dflip is
Port ( D,Clk : in std_logic; // D, clk is declared as input ports
Q : out std_logic; // Q and Qbar is declared as output ports
Qbar : out std_logic:='1');
end dflip;

architecture Behavioral of dflip is


begin
process(clk) // process uses for sequential circuits
begin
if rising_edge(clk) then
Q<= D;
Qbar<= not D;
end if;
end process;
end Behavioral;

Department of CSE, MSEC Page 31


Results:

Department of CSE, MSEC Page 32


Experiment No.9a: Design and implement a mod n (n<8) synchronous up counter
using JK Flip Flop ICs and demonstrate its working.

Description:
The ripple counter requires a finite amount of time for each flip flop to change state.
This problem can be solved by using a synchronous parallel counter where every flip
flop is triggered in synchronism with the clock, and all the output which are scheduled
to change do so simultaneously.
The counter progresses counting upwards in a natural binary sequence from count 000
to count 100 advancing count with every negative clock transition and get back to 000
after this cycle.

Components Used:
IC 74 LS76, IC 74LS08, patch chords, trainer kit.

Pin Diagrams:74LS76

Synchronous counter design:


To successfully design synchronous counters we may employ the following six basic
steps:
1. Create the state transition diagram.
2. Create a present state-next state table (often referred to as the next state table).
3. Expand the table to form the transition table for each flip-flop in the circuit. The
transition table shows the flip-flop inputs required to make the counter go from present
state to the desired next state. This is also referred to as the excitation table.
4. Determine the logic functions of the J and K inputs as a function of the present
states.
5. Analyse the counter to verify the design.
6. Construct and test the counter.

Department of CSE, MSEC Page 33


Function Table:

for initialization

for normal

Functional Truth Table for J-K Flip Flop:


J K Qn Qn+1
0 0
0 0
1 1
0 0
0 1
1 0
0 1
1 0
1 1
0 1
1 1
1 0

State Synthesis Table for JK Flip Flop

Present state Next state J K


0 0 0 X
0 1 1 X
1 0 X 1
1 1 X 0
Employ these techniques to design a MOD-8 counter to count in the following
sequence: 0, 1, 2, 3, 4, 5, 6, 7.
Step1: Creating state transition diagram.

Department of CSE, MSEC Page 34


Step 2: Creating present state-next state table
Present State Next State

Qc Qb Qa Qc Qb Qa
0 0 0 0 0 1

0 0 1 0 1 0

0 1 0 0 1 1

0 1 1 1 0 0

1 0 0 1 0 1

1 0 1 1 1 0

1 1 0 1 1 1

1 1 1 0 0 0

Step 3: Expand the present state-next state table to form the transition table.
Present State Next State Present inputs

Q Q Q Q Q Q J K JB K JA KA
c B A C B A C c B
0 0 0 0 0 0 1 0 X 0 X 1 X

1 0 0 1 0 1 0 0 X 1 X X 1

2 0 1 0 0 1 1 0 X X 0 1 X

3 0 1 1 1 0 0 1 X X 1 X 1

4 1 0 0 1 0 1 X 0 0 X 1 X

5 1 0 1 1 1 0 X 0 1 x X 1

6 1 1 0 1 1 1 X 0 X 0 1 X

7 1 1 1 0 0 0 X 1 X 1 X 1

Department of CSE, MSEC Page 35


Step 4: Use Karnaugh maps to identify the present state logic functions for each of the
‘X’ indicates a "don’t care" condition.
input.

C C
00 01 11 10 00 01 11 10
BA BA
0 0 1 0 x x x x
0 0
x x x x 0 0 1 0
Jc = QbQa Kc=QbQa

C C
00 01 11 10 00 01 11 10
BA BA
0 1 X x x X 1 0
0 0
0 1 X x x X 1 0
Jb = Qa Kb = Qa

C C
00 01 11 10 00 01 11 10
BA BA
1 X X 1 X 1 1 X
0 0
1 X X 1 X 1 1 X
Ja = 1 Ka = 1

Step 5: Trace through indicates circuit should work correctly.

Step 6: Constructing Circuit

A three-bit synchronous counter


Note:
Connect preset and clear to high to work on normal operation

Conclusion:
A mod 8 counter was designed using J K Flip Flop and the truth table is verified.

Department of CSE, MSEC Page 36


Experiment No.9b: Write the verilog/ VHDL code for mod-8 up counter. Simulate
and verify its working.

Description:
A modulus 8 counter has 8 unique states . The
inputs are clock and reset. The operation of
counter is summarized in the truth table below

Truth Table:
rst clock Q2 Q1 Q0
1 x 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
0 0 0 0
Algorithm:
Input :clock and reset
Output: Q
Method:
Execute the code repeated if clk or rst changes
begin
1. If rst is high counter remains stable at state 0
2. If rst is low and if clock occurs the counter progresses through state 0 to 7
end

VHDL Code for MOD-8 Counter:


library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity mod8 is
Port ( rst,clk: in std_logic; // rst and clock is declared as input port
q : buffer std_logic_vector(2 downto 0):="000"); //Q is declares as a buffer as it is
end mod8; // used for input and as output and it should store a value
architecture Behavioral of mod8 is
process(clk,rst) is // process uses for sequential circuits ececutes the code with in if
clk or rst
begin //changes
if (CLK'event and clk='0') then
if(rst='1') then

Department of CSE, MSEC Page 37


q<="000";
else
q <= q+1;
end if;
end if;
end process;
end Behavioral;

Result:

Department of CSE, MSEC Page 38


Experiment No.10: Design and implement asynchronous counter using decade
counter IC to count up from 0 to n (n≤9) and demonstrate on seven segment display
(using IC-7447).

Description:
Asynchronous counter is a counter in which the clock signal is connected to the clock
input of only first stage flip flop. The clock input of the second stage flip flop is
triggered by the output of the first stage flip flop and so on. This introduces an inherent
propagation delay time through a flip flop. A transition of input clock pulse and a
transition of the output of a flip flop can never occur exactly at the same time.
Therefore, the two flip flops are never simultaneously triggered, which results in
asynchronous counter operation.

Components Used:
IC 74 LS90,IC 7447(BCD to seven segment decoder), patch chords, trainer kit.
1.Cp0(pin 14) to be connected to clock
2.Cp1(pin1) to be connected to Q0.( The output of the first flip flop drives the second
clock)

Pin Diagram: 74LS90 / 74LS47

Pin Names Description of 7447:


A0–A3 =BCD Inputs
RBI =Ripple Blanking Input (Active LOW)
LT= Lamp Test Input (Active LOW)
RBO =Ripple Blanking Output (Active LOW)
a –g =Segment Outputs (Active LOW)
Pin Names Description of 7490:
R1 and R2-clear all filpflop (high active and low for not active)
S1 and S2- set all flip flop (high active and low for not active)
CLKA-clock pulse to first flip flop
CLKB-clock pulse to second flip flop (output of first flip flop clock for second filp flop)

Department of CSE, MSEC Page 39


Circuit Diagram:

For mod 9
connect Q0 and Q3 to reset(clear) through an AND gate. Reset should not be
connected to the switch
For mod8
Connect Q3 to reset
For mod7
Connect Q2, Q1,Q0 to reset through an And Gate
For Mod 6
Connect Q2 and Q1 to reset through an AND gate
For mod 5
Connect Q0 and Q2 to reset through an AND gate
For Mod 4
Connect Q2 to
reset For mod 3
Connect Q1 and Q0 to reset through an AND gate
For mod 2
Connect Q1 to
reset Function
Table:

Clock Q3 Q2 Q1 Q0
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0

Department of CSE, MSEC Page 41


9 1 0 0 1

Procedure:

1. Verify all components & patch chords whether they are in good condition or not.
2. Make connections as shown in the circuit diagram.
3. Give supply to the trainer kit.
4. Provide input data to circuit via switches.
5. Verify truth table sequence & observe outputs.

Result:
mod n<=9 counter implemented using the decade counter Ic

Department of CSE, MSEC Page 42


Experiment No.11: Generate a Ramp output waveform using DAC0800(Inputs are
given to DAC through IC74393 dual 4-bit binary counter)
Description:

DAC 0800
 To convert the digital signal to analog signal a Digital-to-Analog Converter (DAC)
has to be employed.
 The DAC will accept a digital (binary) input and convert to analog voltage or
current.
 Every DAC will have "n" input lines and an analog output.
 The DAC require a reference analog voltage (Vref) or current (Iref) source.
 The smallest possible analog value that can be represented by the n-bit binary code
is called resolution.
 The resolution of DAC with n-bit binary input is 1/2n of reference analog value.
 Every analog output will be a multiple of the resolution.
 The DAC0800 require a positive and a negative supply voltage in the range of ±
5V to ±18V.
 It can be directly interfaced with TTL, CMOS, PMOS and other logic families.
 For TTL input, the threshold pin should be tied to ground (VLC = 0V).
 The reference voltage and the digital input will decide the analog output current,
which can be converted to a voltage by simply connecting a resistor to output
terminal or by using an op-amp I to V converter.

Components required:
IC DAC0800, IC 74LS393, OPAMP IC µA741,patch chords, digital trainer kit, bread
board, single stand wires.

Pin diagram & block diagram of dac0800:

Pin diagram of 74LS393 binary counter IC:

Department of CSE, MSEC Page 43


Connection diagram:

14 Vcc
Clk (10KHz)
1 7 Gnd
2
13 74393 12
3 4 5 6 11 10 9 8

2N = 28 = 256 different o/p levels in 28-1 = 255 steps.

Department of CSE, MSEC Page 44


Result :

Department of CSE, MSEC Page 45


Study experiment
Experiment No 12: To study 4-bitALU using IC-74181.

Description:

ALU stands for the arithmetic and logical unit and is one of the important unit in almost
all the calculating machine these days be it with the hand-held mobile, or computers. All
the computational work in the system are carried out by this unit. The typical ALU sizes
are: 4-bit ALU: ALU that processes two 4-bit numbers.8-bit ALU: ALU that processes
two 8-bit numbers. Still in the latest systems ALU sizes are 16, 32, 64-bit etc.Figure-12.1
shows the block diagram of a typical ALU.

Figure-12.1: Block Diagram of ALU

In figure-12.1, the 1x2 selector on the left is as a mode selector to select one of the two
units i.e. either the arithmetic unit or the logical unit. The function select lines are then
used to select one of the many functions of arithmetic or the logical type.
MSI package for ALU:- IC 74181 a 4-bit Arithmetic and logical unit:

Department of CSE, MSEC Page 46


Figure-12.2: Pin Diagram of IC 74181 ALU

Department of CSE, MSEC Page 47


Internal Architecture of ALU IC 74181:

Figure-12.3: Internal Architecture of IC 74181

Function of ALU as seen from figure 12.3:


1. The ALU has two 4-bit input lines A3-A0, B3-B0, and a 4-bit function select lines
S3-S0.
2. One mode select line „M‟ that is used to select ALU for either arithmetic or the
logical function.
3. It has four output lines f3-f0.
4. Carry-in Cn is used in cascade mode.
5. When the size is to be increased to 8-bit operations two 74181 can be cascaded and
Cn+4 will be used as input to Cn line of next stage. The cascading is shown in
figure-12.4.

Department of CSE, MSEC Page 48


Figure-12.4: Cascading of ALU IC 74181 ALU

Department of CSE, MSEC Page 49


The function table of IC 74181 ALU is given in figure-12.5. It shows the functions
selected depending on the Cn, M and S3-S0 lines.

Figure-12.5: Function Table

Equipment Required:
IC 74181 ,LEDs, Power Supply, CRO, Multimeter

Circuit diagram:
LEDs are connected at the input A and B lines and the select lines to indicate the value of
the inputs A and B. The LEDs at the select lines are used to specify the function of the
ALU. The LEDs at the output are used to test and verify the output. The whole
implementation is shown in figure 12.6 is

Figure-12.6: implementation of ALU with IC 74181

Department of CSE, MSEC Page 50


Procedure:
i) Keep the datasheet of IC 74181 ready.
ii) Insert the IC on the Breadboard.
iii) Make connections as shown in figure-12.6
iv) Verify the connections

Result:
The above circuit when connected to power supply gives correct result as per the function
table.

Department of CSE, MSEC Page 51


Sample Viva Questions
1. Why operational amplifier is called by its name?
2. Explain the advantages of OPAMP over transistor amplifiers.
3. List the OPAMP ideal characteristics.
4. Give the symbol of OPAMP
5. Explain the various applications of OPAMP
6. Define UTP and LTP
7. Mention the applications of schmitt trigger
8. What is a square wave generator/ Regenerative comparator?
9. Give the hysterisis curve of a schmitt trigger
10. What is a bipolar and unipolar devices? Give examples
11. Define resolution
12. Explain the need of D/A and A/D converters.
13. List the different types of A/D and D/ A converters
14. What is a multivibrators?
15. What is a bistable multivibrators?
16. Give the applications of monostable and astable multivibrators
17. Explain the working of 555 timer as astable and monostable multivibrator
18. Why astable multivibrator is called as free running multivibrato
19. Define duty cycle.
20. List the applications of 555 timer
21. Explain 555 timer as astable multivibrator to generate a rectangular wave of duty
cycle of less than 0.5
22. Define a logic gate.
23. What are basic gates?
24. Why NAND and NOR gates are called as universal gates?
25. State De morgans theorem
26. Give examples for SOP and POS
27. Explain how transistor can be used as NOT gate
28. Realize logic gates using NAND and NOR gates only
29. List the applications of EX-OR and EX~NOR gates
30. What is a half adder?
31. What is a full adder?
32. Differentiate between combinational and sequential circuits. Give examples
33. Give the applications of combinational and sequential circuits
34. Define flip flop
35. What is an excitation table?
36. What is race around condition?
37. How do you eliminate race around condition?
38. What is minterm an d max term?
39. Define multiplexer/ data selector
40. What is a demultiplexer?
41. Give the applications of mux and demux
42. What is a encoder and decoder?
43. Compare mux and encoder
44. Compare demux and decoder
45. What is a priority encoder?
46. What are counters? Give their applications.

Department of CSE, MSEC Page 52


47. Compare synchronous and asynchronous counters
48. What is modulus of a number?
49. What is a shift register?
50. What does LS stand for, in 74LSOO?
51. What is positive logic and negative logic?
52. What are code converters?
53. What is the necessity of code conversions?
54. What is gray code?
55. Realize the Boolean expressions for
a Binary to gray code conversion
b Gray to binary code conversion

[Type text] Page 53

You might also like