BCA II Sem Digital Electronics
BCA II Sem Digital Electronics
Digital
Electronics
nd
BCA– II Sem
Prepared By
Mr. SUSHANT SRIVASTAVA
(Assistant Professor)
Kulbhaskar Ashram Post Graduate College, Allahabad
2
BCA IInd Sem, Course Code - BCA-S109 (Digital Electronics),
Contents
UNIT-I
Logic gates and circuit
Gates (OR, AND, NOR, NAND, XOR & XNOR); Demogran’s laws; Boolean laws,
Circuit designing techniques (SOP, POS, K-Map).
UNIT 1
Q1: What is Logic Gates? Explain types of gates (OR, AND, NOR,
NAND, XOR & XNOR)?
Answer:
A logic gate is an idealized or physical device implementing a Boolean function,
that is, it performs a logical operation on one or more logical inputs, and produces a
single logical output. Depending on the context, the term may refer to an ideal logic
gate, it has two state 0 or 1, all gates perform on this input and generate result
according to input.
Logic gates
A logic gate is an elementary building block of a digital circuit. Most logic gates
have two inputs and one output. At any given moment, every terminal is in one of the
two binary conditions low (0) or high (1), represented by different voltage levels. The
logic state of a terminal can, and generally does, change often, as the circuit
processes data. In most logic gates, the low state is approximately zero volts (0 V),
while the high state is approximately five volts positive (+5 V).
There are seven basic logic gates: AND, OR, NOT, NAND, NOR, XOR and
XNOR.
The AND gate is so named because, if 0 is called "false" and 1 is called
"true," the gate acts in the same way as the logical "and" operator. The following
illustration and table show the circuit symbol and logic combinations for an AND
gate. (In the symbol, the input terminals are at left and the output terminal is at right.)
The output is "true" when both inputs are "true." Otherwise, the output is "false."
The OR gate gets its name from the fact that it behaves after the fashion of
the logical inclusive "or." The output is "true" if either or both of the inputs are "true."
If both inputs are "false," then the output is "false."
A logical inverter , sometimes called a NOT gate to differentiate it from other
types of electronic inverter devices, has only one input. It reverses the logic state.
The NAND gate operates as an AND gate followed by a NOT gate. It acts in
the manner of the logical operation "and" followed by negation. The output is "false"
if both inputs are "true." Otherwise, the output is "true."
The NOR gate is a combination OR gate followed by an inverter. Its output is
"true" if both inputs are "false." Otherwise, the output is "false."
The XOR ( exclusive-OR ) gate acts in the same way as the logical
"either/or." The output is "true" if either, but not both, of the inputs are "true." The
output is "false" if both inputs are "false" or if both inputs are "true." Another way of
looking at this circuit is to observe that the output is 1 if the inputs are different, but 0
if the inputs are the same.
The XNOR (exclusive-NOR) gate is a combination XOR gate followed by an
inverter. Its output is "true" if the inputs are the same, and "false" if the inputs are
different.
Boolean algebra
The term "Boolean algebra" honors George Boole (1815–1864), a self-
educated English mathematician. He introduced the algebraic system initially in a
small pamphlet, The Mathematical Analysis of Logic, published in 1847 in response
to an ongoing public controversy between Augustus De Morgan and William
Hamilton, and later as a more substantial book, The Laws of Thought, published in
1854. Boole's formulation differs from that described above in some important
respects. For example, conjunction and disjunction in Boole were not a dual pair of
operations. Boolean algebra emerged in the 1860s, in papers written by William
Jevons and Charles Sanders Peirce. The first systematic presentation of Boolean
algebra and distributive lattices is owed to the 1890 Vorlesungen of Ernst Schröder
Boolean Function
A Boolean function defined as an algebraic expression formed with the binary
variables, the logic operation symbols, parenthesis and equal to sign. Ex. F = A.B+C
A Boolean function can be broken into logic diagram, and vice versa.
Logic Gates
Logic gate is an electronic circuit, which produces a typical output signal
depending on its input signal. The output signal of a gate is a simple Boolean
operation of its input signal. Gates are the basic logic elements. Any Boolean
function can be represented in the form of gates.
In general we can represent gates in three ways. These are:
• Graphic symbols
• Algebraic notation
• Truth table
versa. Any connection that has logic negations at both ends can be replaced by a
negationless connection and a suitable change of gate or vice-versa. Any
connection that has a negation at one end and no negation at the other can be made
easier to interpret by instead using the De Morgan equivalent symbol at either of the
two ends. When negation or polarity indicators on both ends of a connection match,
there is no logic negation in that path (effectively, bubbles "cancel"), making it easier
to follow logic states from one symbol to the next. This is commonly seen in real
logic diagrams - thus the reader must not get into the habit of associating the shapes
exclusively as OR or AND shapes, but also take into account the bubbles at both
inputs and outputs in order to determine the "true" logic function indicated.
De Morgan's theorem is most commonly used to implement logic gates as
combinations of only NAND gates, or as combinations of only NOR gates, for
economic reasons.
The two theorems suggested by De-Morgan which are extremely useful in
Boolean Algebra are as following.
Theorem 1
Theorem 2
Prove: (A*B)*( A + B) = 0
(A*B)*( A + B) = (A*B)*A + (A*B)*B) by distributive postulate
= (A*A)*B + A*(B*B) by associativity postulate
= 0*B + A*0 by complement postulate
=0+0 by nullity theorem
=0 by identity theorem
(A*B)*( A + B) = 0 Q.E.D.
Prove: (A*B) + ( A + B) =1
(A*B) + ( A + B) =(A + A + B))*(B + A + B) by distributivity B*C + A = (B + A)*(C + A)
(A*B) + ( A + B) =(A + A + B))*(B + B + A) by associativity postulate
=(1 + B)*(1 + A) by complement postulate
=1*1 by nullity theorem
=1 by identity theorem
(A*B) + ( A + B) =1 Q.E.D.
The stepwise procedure for Karnaugh maps is to create a simple map depending
on the number of variables in the function show the map of 2,3,4 variable. A map of
2 variable contains 4 value position or element, while for 3 variable it has 23 = 8
elements similarly for 4 variable it is 24 = 16 element and so on. Special care is taken
to represent variables in the map. Value of only 1 variable changes into adjacent
columns and rows.
Each square in a Karnaugh map corresponds to a minterm (and maxterm).
Often it is desired to simplify a Boolean function. A quick graphical approach is
to use Karnaugh maps.
Model Question
• Explain Universal gate with diagram
• De-Morgan theorem
• Given that F (a, b, c, d) = Σ(0, 1, 2, 4, 5, 7), derive the product of maxterms
expression of F and the 2 standard form expressions of F`
4. (X')' = X
Laws of complementarity:
6. X+Y=Y+X 6D. XY = YX
Associative laws:
Contents
UNIT-II
Combinational Building Blocks
Multiplexes; Decoder; Encoder; Adder and Subtracter.
UNIT 2
Combinational circuits
Combinational circuits are interconnected circuits of gates according to certain
rule to produce an output depending on its input value. A well-formed combinational
circuit should not have feedback loops. A combinational circuit can be represented
as a network of gates and, therefore, can be expressed by a truth table or Boolean
expression. The outputs of Combinational Logic Circuits are only determined by the
logical function of their current input state, logic "0" or logic "1", at any given instant
in time as they have no feedback, and any changes to the signals being applied to
their inputs will immediately have an effect at the output. In other words, in
a Combinational Logic Circuit, the output is dependant at all times on the
combination of its inputs and if one of its inputs condition changes state so
does the output as combinational circuits have "no memory", "timing" or
"feedback loops". Circuits in which all outputs at any given time depend only
on the inputs at that time are called combinational logic circuits shown in figure
1
COMBINATIONAL
A LOGIC X one or
Multiple inputs
B
CIRCUIT more
outputs
C Y
1. Boolean Algebra – This forms the algebraic expression showing the operation
of the logic circuit for each input variable either True or False that results in a
logic "1" output.
2. Truth Table – A truth table defines the function of a logic gate by providing a
concise list that shows all the output states in tabular form for each possible
combination of input variable that the gate could encounter.
3. Logic Diagram – This is a graphical representation of a logic circuit that shows
the wiring and connections of each individual logic gate, represented by a specific
graphical symbol, that implements the logic circuit.
TRUTH TABLE
A B C Q
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 0
Adders
Digital Computers perform a variety of information processing tasks. Among the
basic functions encountered are the various arithmetic operations. The most basic
arithmetic operation, no doubt is the addition of two binary digits. This simple
addition consists of four possible elementary operations, namely, 0 + 0 = 0, 0+1 =
1,1+0=1, and 1 + 1 = 10. The first three operations produce a sum whose length is
one digit, but when both augend and addend bits are equal to 1, the binary sum
consists of two digits. The higher significant bit of this result is called a carry. When
the augend and addend numbers contain more significant digits, the carry obtained
from the addition of two bits is added to the next higher-order pair of significant bits.
A combinational circuit that performs the addition of two bits is called a half-adder.
There are two types of adders.
1. Half Adder
2. Full Adder
Half Adder
From the verbal explanation of a half-
adder, we find that this circuit needs two binary
inputs and two binary outputs. The input
variables designate the augend and addend bits;
the output variables produce the sum and carry.
It is necessary to specify two output variables
because the result may consist of two binary
digits. We arbitrarily assign symbols x and y to
the two inputs and S(for sum) and C (for carry) to the outputs.
Now we have established the number and names of the input and output
variables, we are ready to formulate a truth table to identify exactly the function of
the half-adder. The truth table for half adder is
X Y Carry Sum
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
Truth table for Half-adder
The carry output is 0 unless both inputs are 1.The S output represents the
least significant bit of the sum. The simplified Boolean functions for the two outputs
can be obtained directly from the truth table. The simplified sum of products
expressions are
S = x’y + xy’
C = xy
(The symbol ’ denots
complement and is
used throughout the
text to represent
complement
operation)
The logic
diagram for this
implementation is
shown in below
Figure 2, as are four
other
implementations for a
half-adder. They all
achieve the same
result as far as the
input-output behavior
is concerned. They
illustrate the flexibility
available to the
designer when
Prepared By : SUSHANT SRIVASTAVA (Assistant Professor), Kulbhashkar Ashram PG College
16
BCA IInd Sem, Course Code - BCA-S109 (Digital Electronics),
The S output from the second half-adder is the exclusive-OR of z and the output of
the first half-adder, giving
S = z (x y)
= z’(xy’ + x’y) + z(xy’ + x’y)’
= z’(xy’ + x’y) + z(xy + x’y’)
= xy’z’ + x’yz’ + xyz + x’y’z
and the carry output is
C = z(xy’ + x’y) + xy
= xy’z + x’yz + xy
= xy+yx+zx (after applying Boolean rules)
Subtractors
Half Subtractor:
A half subtractor is a
combinational logic circuit which is used
to find the difference between two binary
digits.
A B BORROW(Br) DIFFERENCE(D)
0 0 0 0
0 1 1 1
1 0 0 1
1 1 0 0
Truth table for half subtractor
Thus
Br = A'B, and
D=A’B+AB’
Using the above Boolean expressions, the logic circuit for half subtractor is shown in
Figure 6
Full Subtractor: X
Y
A full subtractor is a combinational circuit
that performs a subtraction between two bits
taking into account that a 1 may have been
Input Output
borrowed by a lower
X Y Z B D significant stage.
0 0 0 0 0 Z
0 0 1 1 1 This circuit has three
0 1 0 1 1
inputs and two outputs. The three inputs X, Y and Z denote
0 1 1 1 0
1 0 0 0 1 the minuend, subtrahend and previous borrow respectively.
1 0 1 0 0 The two outputs D and B represent the difference and
1 1 0 0 0 borrow, respectively. The truth table for the circuit is as
1 1 1 1 1 follows.
I0
4x1
I1 O
MUX
I2
I3
4x1 Multiplexer
Figure 15 : Multiplexer
Demultiplexer
Demultiplexer: A decoder with enable input, acts as demultiplexer.
Demultiplexer is a logical circuit that takes a single input source and sends it to one
n
of several 2 possible output lines. The selection of specific output line is controlled
by the bit values of ‘n’ selection lines.
Binary Demultiplexer
The demultiplexer shown in figure 16 three input lines and one data input and
produse 8 output lines It is instructive to compare this demultiplexer circuit with the
multiplexer circuit for the same number of control (select) inputs, there are the same
number of AND gates. But now each AND gate output is a circuit output. Rather than
each gate having its own eparate data input, the single data line now forms one of
the inputs to each AND gate, the other AND inputs being control inputs.
Demultiplexer
of 1, and the outputs present the binary number that identifies which input is equal to
1. The truth table for a 4-to-2 encoder is provided in Figure 12. Observe that the
output y0 is 1 when either input w1 or w3 is 1, and output y1 is 1 when input w2 or w3
is 1. Hence these outputs can be generated by the circuit in Figure b. Note that we
assume that the inputs are one-hot encoded. All input patterns that have multiple
inputs set to 1 are not shown in the truth table, and they are treated as don’t-care
conditions. Encoders are used to reduce the number of bits needed to represent
given information.
A practical use of encoders is for transmitting information in a digital system.
Encoding the information allows the transmission link to be built using fewer wires.
Encoding is also useful if information is to be stored for later use because fewer bits
need to be stored.
8x3 ENCODER:- 8 x 3 encoder encodes 8 bit information and produces 3
outputs corresponding to binary numbers. This type of encoder is also called octal-
to- binary encoder. The truth table of encoder is shown in figure 13
I0
I1 o1
I2 8x3
I3 Encoder o2
I4
I5 o3
I6
I7
Contents
UNIT-III
UNIT 3
Input Output
If you follow the feedback path, you can see that if Q happens to be 1 (or 0), it
will always be 1 (or 0). Since it's nice to be able to control the circuits we create, this
one doesn't have much use -- but it does let you see how feedback works. It turns
out that in "real" sequential circuits, you can actually use this sort of simple inverter
feedback approach. The memory elements in these circuits are called flip-flops. A
flip-flop circuit has two outputs, one for the normal value and one for the complement
value of the stored bit. Binary information can enter a flip-flop in a variety of ways
and gives rise to different types of flip-flops.
Input Outputs
S R Q Q’
1 0 1 0
0 0 1 0 (after S=1,R=0)
0 1 0 1
0 0 0 1 (after S=0,R=1)
1 1 0 0 UNDEFINED
(a) (b)
Figure 3 : Logic diagram of basic flip flop
RS Flip-Flop
RS flip-flop is the simplest possible memory element. It can be constructed
from two NAND gates or two NOR gates. Let us understand the operation of the RS
flip-flop using NOR gates as shown in figure 4, using the truth table for ‘A NOR B’
gate. The inputs R and S are referred to as the Reset and Set inputs, respectively.
The outputs Q and Q' are complements of each other and are referred to as the
normal and complement outputs, respectively. The binary state of the flip-flop is
taken to be the value of the normal output. When Q=1 and Q'=0, it is in the set state
(or 1-state). When Q=0 and Q'=1, it is in the reset/clear state (or 0-state).
JK Flip Flop
The JK flip flop (JK means Jack Kilby, a Texas instrument engineer, who
invented it) is the most versatile flip-flop, and the most commonly used flip flop. Like
the RS flip-flop, it has two data inputs, J and K, and an EN/clock pulse input (CP).
Note that in the following circuit diagram NAND gates are used instead of NOR
gates. It has no undefined states, however. The fundamental difference of this
device is the feedback paths to the AND gates of the input, i.e. Q is AND-ed with K
and CP and Q’ with J and CP
Master-Slave JK Flip-Flop
Although JK flip-flop is an improvement on the clocked SR flip-flop it still
suffers from timing problems called "race" if the output Q changes state before the
timing pulse of the clock input has time to go "OFF", so the timing pulse period (T)
Prepared By : SUSHANT SRIVASTAVA (Assistant Professor), Kulbhashkar Ashram PG College
28
BCA IInd Sem, Course Code - BCA-S109 (Digital Electronics),
Figure 8: Characteristic table & Circuit diagram of Master Slave flip flop
T Flip Flop
The T flip-flop is a single input version of the JK flip-flop. The T flip-flop is obtained
from the JK type if both inputs are tied together.
• Same as Master-Slave JK flip-flop with J=K=1
• The toggle, or T, flip-flop is a bistable device, where the output of the T flip-flop
"toggles" with each clock pulse.
• Till CP=0, the output is in hold state (three input AND gate principle).
• When CP=1, for T=0, previous output is memorized by the circuit. When T=1
along with the clock pulse, the output toggles from the previous value as given
in the characteristic table below.
Characteristic Table:
Answer:
Register
A register is a memory device that can be used to store more than one bit of
information. They usually realized by several flip-flops with common control signals
that control the movement of data to and from the register. Common refers to the
property that the control signals apply to all flip-flops in the same way. A register is a
generalization of a flip-flop. Where a flip-flop stores one bit, a register stores several
bits. Register is a group of flip-flops. Each flip-flop is capable of storing one bit of
information. An n-bit register consists of a group of n flip-flops. Register is a group of
binary cells suitable for holding binary information.
The main operations on a register are the same as for any storage devices, namely
Parallel registers:
Shift Register:
A shift register is used for shifting the data to the left or right. A shift register
operates in serial input-output mode i.e. data is entered in the register one bit at a
time from one end of the register and can be read from the other end as one bit at a
time. Figure 2 shows a 4-bit right shift register using D logical shift functions.
4-BIT RIGHT-SHIFT REGISTER: A register, which shifts data only in one direction,
is called unidirectional shift register and a register, which can shift data in both
directions, is called M-directional shift register, Shift register can be constructed for
bi-directional shift with parallel input-output. A general shift register structure may
have parallel data transfer to or from the register along with added facility of left or
right shift. This structure will require additional control line for indicating whether
parallel or serial output is desired and left or right shift is required, A general
symbolic diagram is shown in Fig. for this register.
There are 3 main control lines shown in the below figure. If parallel load enable is
active, parallel input-output operation is done otherwise serial input- output shift
select line for selecting right or left shilt. If it has value 0 then right shift is performed
and for value 1, left shift is done, Shift enable signal indicates when to start shift.
Right shift data input Parallel data input Left shift data input
Enable for
Parallel load
Shift select
Shift enable
Clear
4-BIT REGISTER
Output Right shift data
output
Parallel data input
Counters
Figure 4 : Counters
Asynchronous counters:
This is more often referred to as ripple counter, as the change, which occurs in
order to increment the counter ripples through it from one end to the other. Figure 5
shows an implementation of 4-bit ripple counter using J-K flip-flops. This counter is
incremental on the occurrence of each clock pulse and counts from 0000 to 1111
(i.e. 0 to 15).
The input line to J & K of all flip-flops is kept high i.e. logic 1. Each time a clock
pulse occurs the value of flip-flop is complemented. The clock pulse is given only to
first flip-flop, so first FF changes rate at trailing edge of each dark pulse, but record
FF changes rate at trailing of Q output of first flip flop, this continues to the next flip
flops. This implies that these flip-flops will be complemented if the previous flip-flop
has a value 1. Thus, the effect of complement will ripple through these flip-flops.
Synchronous counter:
The major disadvantage of ripple counter is the delay in changing the state. For
example we take an instance when the state of ripple counter is 0111. Now the next
state will be 1000, which means change in the state of all flip-flops. But will it occur
simultaneously in ripple counter? No, first Q0 will change then Q1, Q2 & lastly Q3.
The delay is proportional to the length of the counter. Therefore, to avoid this
disadvantage of ripple counters, synchronous counters are used in which all flip-
flops change their states at same time. Below Figure 6 shows 4-bit synchronous
counter.
Let us assume that the flip flops are initially reset to produce 0 outputs. If we
consider A to be the least significant bit (LSB) and C the most significant bit (MSB)
then we can say the contents of the counter is CBA = 000.
Every time there is a negative clock transition, flip flop A will change states.
Thus at point ‘a’ on the time line, A goes high, at point ‘b’ it goes back low, at ‘c’ it
goes back high and so on.
As A acts as the clock for B, each time the wave form at A goes low, flip flop B
will toggle. Thus at point ‘b’ on that time line, B goes high. It then goes low at point
‘d’ and toggles back high again at point ‘f’. Note that the wave form at the output of
the flip flop B is one half the frequency of A and one fourth the clock frequency.
Since B acts as a clock for C, each time the wave form at B goes low, flip flop
C will toggle. Thus C goes high at point ‘d’ on the time line and goes back low again
at point ‘h’. The frequency of the wave form at C is one half that at B, but it is only
one-eighth the clock frequency.