Digital Electronics SPH 323
Digital Electronics SPH 323
DIGITAL ELECTRONICS
• Course Content
1.Number systems:- decimal, octal, hexadecimal
systems and their conversions, 1s and 2s
complement, floating point, BCD and excess- 3
codes.
2. Introduction to logic gates and their logic
operations:- AND, OR, XOR, NOT, NAND, NOR, and
XNOR, their truth tables and their applications.
3. Boolean algebra and functions:-Boolean
theorems, De Morgan theorems, minimization and
manipulation of logic functions, Karnaugh maps
and their applications.
• 4. Combinational logic circuit designs,
programmable logic devices.:-adders,
subtractors, decoders, encoders, multiplexers,
DE multiplexers and error control circuits
• 5. Memory elements: flip-flops, latches, shift
registers and counters, Sequential circuits
design using flipflops and logic gates. State
diagrams and state tables, classification of
sequential circuits and applications.
Introduction to Data transmission.
• REFERENCES:
• Digital Electronics Part I – Combinational and
Sequential Logic Dr. I. J. Wassell
• -D. M. Harris and S. L. Harris, ‘Digital Design and
Computer Architecture,’ Morgan Kaufmann,
2007.
introduction
• Digitization is the process of converting analog signals
into discrete states a process called digitization . The
states are well separated such electronic noise does
not create errors which allows
Storage over arbitrary period of time without
deterioration
Flawless retrieval and reproduction of stored
information
Flawless transmission of information
Analog signals include temperature, pressure, velocity,
mass
digitization involves two steps;
i. sampling
ii. quantization
sampling is the process of recording an analog signal at regular discrete intervals of
time. The sampling rate is the number of samples per second also measured in
hertz (Hz).
Groups of 4 groups
1010=
1011=
Conversion between bases(BASE 2)
• The integer and fractional parts are worked out
separately.
• divide decimal/integer value by 2 (the base) and record
the remainder until the quotient is 0
• The carry sequence written in 4ward order constitutes
the binary equivalent
• Write remainders from LAST to FIRST
• For the fractional part, successively multiply the
fractional part of the decimal number by 2 and record
the carry until the multiplication result is 0. The carry
sequence is written in 4ward order from FIRST to LAST
• 13 .37510 to binary
13 r
2 6 1
2 3 0
2 1 1
2 0 1 1101
0.375 x2=0.75 0
0.75 x2 =1.5 1
0.5 x2 =1.0 1
0X2=0
13.37510 =1101.011
10100.0011
0.24X2=0.48 0
0.48X2=0.96 0
0.96X2= 1.92 1
0.92X2=1.84 1
0.84X2=1.68 1
0.68………..
20/2 =10 REM 0
10/2=5 REM 0
5/2=2REM 1
2/2=1REM 0
1/2=0REM 1
Decimal to octal
• Progressive division in case of integer part and
progressive multiplication by 8 which is the radix
• (153)10 to octal
153 r
(8) 19 1
2 3
0 2 (231)8
• Quiz,
• Find the octal equivalent of (73.75)10
• 111.6
Decimal to hexadecimal
Progressive division in case of integer part and
progressive multiplication by 16 which is the radix
(82.25)10 to hexadecimal
(16) 82 r convert 195.75
5 2 to base 16
195/16=12 r 3
12/16=0 re 12 (C)
0 5 C3.12
=52.416
0.25X16=4
Binary to octal and hexacimal
conversion
• 23 = 8 group binary numbers into groups of 3
• 24 = 16 “ “ 4
111
1101 +
1011
11000
11
519
145
1101_
1011
Negative integers
a. sign-magnitude convention: It uses one bit
(usually the leftmost) to indicate the sign. "0"
indicates a positive integer, and "1" indicates a
negative integer. The rest of the bits are used for
the magnitude of the number
e.g +4=0100 while -4=1100
b. 1’s complement -The one’s complement of a
negative binary number is the complement of its
positive counterpart i.e 1 changes to 0 and 0 to 1.
i.e +=0100 while -4=1011
1’s complement is implemented using NOT gates
c. 2’s complement
Preferred because it has only one value for 0
Complement the bits
Add one to the result
Subtraction using 1’s complement
• Take 1‟s complement of the negative number
and the end around carry of the sum is added
to the least significant bit (LSB)
• Addition and subtraction in 2's complement
notation is performed by doing the simple binary
addition of the two numbers. Subtraction is
accomplished by first performing the 2's
complement operation on the number being
subtracted then adding the two numbers.i.e
3-2=0011 -0010 1101
0011+ 1
1110
10001 =0001
• The operation is carried out by means of the
following steps:
• (i) At first, 2’s complement of the subtrahend is
found.
• (ii) Then it is added to the minuend.
• (iii) If the final carry over of the sum is 1, it is
dropped and the result is positive.
• `(iv) If there is no carry over, the two’s
complement of the sum will be the result and it is
negative e.g
assignment
1. Perform the following using 1’s complement
arithmetic
a. 1𝐴𝐵𝐶16 + 1𝐷𝐸𝐹16 (2mks)
b. +4310 − (−5310 ) (2mks)
c. 3𝐸9116 − 1𝐹9316 (2mks)
2. Repeat quiz 1 using 2’s compement (6mks)
Binary codes
• Representing decimal numbers with their
decimal equivalent
Weighted codes-Binary coded decimal
Non-weighted codes-excess 3 , gray code
• 8421 Code or BCD Code The decimal numbers
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 can be expressed in
Binary numbers as shown below. All these
binary numbers again expressed in the last
column by expanding into 4 bits. As per the
weighted binary digits, the 4 Bit binary
numbers can be expressed according to their
place value from left to right as 8421 (2³ 2² 2¹
2: = 8421).
Floating point (FP) number
representation
• Real numbers are numbers that include
fractions/values after the decimal point.
• Used to represent a real number in a wide
range(very small to very large)
• For example, 123.75 is a real number. This type of
number is also known as a floating point
number.
• All floating point numbers are stored by a
computer system using a mantissa and
an exponent.
• 1.2375 x 102 = 123.75 M X 10E
In binary the number is 1111011.11=1.1110111x26
1.11101111 x 2110
0 0 1 1 0 1 1 1
sign Sign Magnitude bits Man
expo mag tissa
either switch can be closed, or at logic “1” for the lamp to be “ON”.
Either transistor must be saturated
“ON” for an output at Q.
7432 quad OR gate
NOT gate
The NOT gate is an electronic circuit that produces an
inverted version of the input at its output. It is also known
as an inverter.
The 'Exclusive-OR' gate is a circuit which will give a high output if either, but not both, of its two
inputs are high. An encircled plus sign ( is used to show the EOR operation.
)
EXNOR gate
When a long bar is broken, the operation directly underneath the break changes
from addition to multiplication, or vice versa, and the broken bar pieces remain over
the individual variables.
• When multiple “layers” of bars exist in an
expression, you may only break one bar at a
time, and it is generally easier to begin
simplification by breaking the longest
(uppermost) bar first.
Quiz: simplify the circuit below
Quiz 2
Design a logic circuit which will open the waste valve is opened if at least two out
of the three sensors show good flame
Simplify the circuit diagram below
Simplification using K-maps
• Karnaugh Maps offer a graphical method of
reducing a digital circuit to its minimum
number of gates. It contains 2𝑛 cells
• The Karnaugh map uses the following rules for
the simplification of expressions by grouping
together adjacent cells containing ones
• A.
B.
C
D.
E.
F
G
• H.
Summmary:
1. No zeros allowed.
2. No diagonals.
3. Only power of 2 number of cells in each
group.
4. Groups should be as large as possible.
5. Every one must be in at least one group.
6. Overlapping allowed.
7. Wrap around allowed.
8. Fewest number of groups possible.
examples
i
ii.
iii.
iv.
• Simplify the expression f(XYZ)=sum(2,3 ,7)
A B S C(out)
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
Half adder circuit
Full adder
• The main difference between the Full Adder
and the previous Half Adder is that a full
adder has three inputs. The same two single
bit data inputs A and B as before plus an
additional Carry-in (C-in) input to receive the
carry from a previous stage as shown below.
Half subtractor
• Half subtractor is a combination circuit with
two inputs and two outputs (difference and
borrow). It produces the difference between
the two binary bits at the input and also
produces an output (Borrow) to indicate if a 1
has been borrowed. In the subtraction (A-B), A
is called as Minuend bit and B is called as
Subtrahend bit.
Truth table
Full subtractor
• The main difference between the Full
Subtractor and the previous Half Subtractor
circuit is that a full subtractor has three
inputs. The two single bit data inputs X
(minuend) and Y (subtrahend) the same as
before plus an additional Borrow-in (B-in)
input to receive the borrow generated by the
subtraction process from a previous stage as
shown below.
Truth table
Full adder circuit
Binary subtractor using 2’s
complement
Programmable Logic Device(PLD)
• Each of the input variables, both in its
uncomplemented and complemented form,
are inputs to AND gates through fuses. (The S-
shaped lines in the circuit diagram represent
fuses.) The fuses can be “blown” or left in
place in order to program each AND gate to
output a product. Since every input, plus its
complement, is input to each AND gate, any of
the AND gates can be programmed to output
a minterm.
• Some are pre-programmed at the time of
manufacture. Others are programmed by the
manufacturer. And there are types that can be
programmed by a user. Some can even be erased
and reprogrammed.
• Programmable Logic Array (PLA)Both the AND
gate plane and the OR gate plane are
programmable.
• Read Only Memory (ROM)Only the OR gate plane
is programmable.
• Programmable Array Logic (PAL)Only the AND
gate plane is programmable.
Multiplexers
• A device that selects one of multiple inputs to be
passed on as the output based on one or more
selection lines. Up to 2𝑛 inputs can be selected
by n selection lines.
• There are many places in the CPU where one of
several signals must be selected to pass onward.
E.g values to be added in the CPU may come from
a CPU register, come from memory, or actually be
stored as part of the instruction itself. The device
that allows this selection is essentially a switch.
Output Q=?
Applications of MUX
• Communication System
• A communication system has both a
communication network and a transmission
system. By using a multiplexer, the efficiency
of the communication system can be
increased by allowing the transmission of
data, such as audio and video data from
different channels through single lines or
cables.
• Multiplexers are used in computer memory to maintain
a huge amount of memory in the computers, and also
to reduce the number of copper lines required to
connect the memory to other parts of the computer.
• In telephone networks, multiple audio signals are
integrated on a single line of transmission with the
help of a multiplexer
• The multiplexer is used to transmit the data signals
from the computer system of a spacecraft or a satellite
to the ground system by using a GSM satellite.
Demultiplexer
• The demultiplexer takes one single input data
line and then switches it to any one of a
number of individual output lines one at a
time. The demultiplexer converts a serial data
signal at the input to a parallel data at its
output lines as shown below.
Logic circuit demux
Applications of DEMUX
• Communication System
• Mux and demux both are used in communication systems to carry out the
process of data transmission. A De-multiplexer receives the output signals
from the multiplexer and at the receiver end, it converts them back to the
original form.
• Arithmetic Logic Unit
• The output of the ALU is fed as an input to the De-multiplexer, and the
output of the demultiplexer is connected to multiple registers. The output
of the ALU can be stored in multiple registers.
• Serial to Parallel Converter
• This converter is used to reconstruct parallel data. In this technique, serial
data is given as an input to the De-multiplexer at a regular interval, and a
counter is attached to the demultiplexer at the control input to detect the
data signal at the output of the demultiplexer. When all data signals are
stored, the output of the demux can be read out in parallel.
encoder
• It has maximum of 2n input lines and ‘n’
output lines.
• Let 4 to 2 Encoder has four inputs Y3, Y2, Y1 &
Y0 and two outputs A1 & A0. The block
diagram of 4 to 2 Encoder is shown in the
following figure.
Boolean function
At any time, only one of these 4 inputs can be ‘1’ in order to get the respective binary
code at the output.
2𝑛 𝑖𝑛𝑝𝑢𝑡𝑠 − 𝑛𝑜𝑢𝑡𝑝𝑢𝑡𝑠
N=1
2------------1
N=2
4------------2
N=3
8------------3
N=4
16-----------4
23 = 8 𝑖𝑛𝑝𝑢𝑡𝑠
n =3 Outputs
01 = 𝑦2 + 𝑦3
The Boolean function ;
Circuit diagram for 4-2 priority
encoder
Applications of encoders ; Keyboard
Encoder Priority encoders can be used to reduce the number of wires needed in a
particular circuits or application that have multiple inputs. For example, assume that a
microcomputer needs to read the 104 keys of a standard QWERTY keyboard where only
one key would be pressed either “HIGH” or “LOW” at any one time. One way would be to
connect all 104 wires from the individual keys on the keyboard directly to the computers
input but this would be impractical for a small home PC. Another alternative and better
way would be to interface the keyboard to the PC using a priority encoder. The 104
individual buttons or keys could be encoded into a standard ASCII code of only 7- bits (0
to 127 decimal) to represent each key or character of the keyboard and then input as a
much smaller 7-bit B.C.D code directly to the computer. Keypad encoders such as the
74C923 20-key encoder are available to do just that
Applications of the Encoder and Decoder
• Speed synchronization of multiple motors in
industries.
• War field flying robot with a night vision flying
camera.
• Robotic vehicle with the metal detector.
• RF based home automation system.
• Automatic health monitoring systems
decoders
• A Binary Decoder converts coded inputs into
coded outputs, where the input and output
codes are different and decoders are available
to “decode” either a Binary or BCD (8421
code) input pattern to typically a Decimal
output code. Commonly available BCD-
to Decimal decoders include the TTL 7442 or
the CMOS 4028, 2-to-4, 3-to-8 and 4-to-16
line configurations.
• Some binary decoders have an additional input
pin labelled “Enable” that controls the outputs
from the device. This extra input allows the
decoders outputs to be turned “ON” or “OFF” as
required. These types of binary decoders are
commonly used as “memory address decoders”
in microprocessor memory applications. A, B and
C as address signals. Each combination of A, B or
C defines a unique memory address.
• `
Boolean functions
Each output is having one product term. So, there are four
product terms in total. We can implement these four product
terms by using four AND gates having three inputs each & two
inverters. The circuit diagram of 2 to 4 decoder is shown in the
following figure.
2 to 4 decoder with enable
Implementation of Higher-order Decoders
• Now, let us implement the following two higher-order decoders using lower-order
decoders.
• 3 to 8 decoder
• 4 to 16 decoder
• 3 to 8 Decoder
• In this section, let us implement 3 to 8 decoder using 2 to 4 decoders. We know
that 2 to 4 Decoder has two inputs, A1 & A0 and four outputs, Y3 to Y0. Whereas, 3
to 8 Decoder has three inputs A2, A1 & A0 and eight outputs, Y7 to Y0.
• We can find the number of lower order decoders required for implementing
higher order decoder using the following formula.
𝑚
• Required number of lower order decoders= 2
𝑚1
• Where m2=no of outputs of higher order decoders
• m1 =‘’ ‘’ ‘’ lower order decoders
Therefore, we require two 2 to 4 decoders for implementing one 3 to 8 decoder.
The block diagram of 3 to 8 decoder using 2 to 4 decoders is shown in the following
figure.