Decoder
In digital Electronics, discrete quantities of information are
represented by binary codes. A binary code of n bits is capable of
representing upto 2n distinct elements of coded information. The
name “Decoder” means to translate or decode coded information from
one format into another, so a digital decoder transforms a set of
digital input signals into an equivalent decimal code at its output.
A decoder is a combinational circuit that converts binary
information from n input lines to a maximum of 2n unique output
lines. One of these outputs will be active High based on the
combination of inputs present when the decoder is enabled.
Block diagram of Decoder:
2n data outputs
n data inputs
Decoder
2 to 4 Decoder:
Let 2 to 4 has two inputs A1 & A0 and four outputs Y3, Y2, Y1 & Y0.
The block diagram of 2 to 4 decoder is shown in the following
figure:
A1 Y3
2 to 4
A0 Y2
Decoder Y1
E Y0
Subhajit Saha, Dept. of Computer Science Rajganj College
One of these four outputs will be ‘1’ for each combination of inputs
when enable, E is ‘1’, The truth table of 2 to 4 decoder is shown
below:
Enable Inputs Outputs
E A1 A0 Y3 Y2 Y1 Y0
0 X X 0 0 0 0
1 0 0 0 0 0 1
1 0 1 0 0 1 0
1 1 0 0 1 0 0
1 1 1 1 0 0 0
From the truth table, we can write the Boolean functions for each
output as:
Y3 = E.A1.A0
Y2 = E.A1.𝐴𝐴̅0
Y1 = E.𝐴𝐴̅1.𝐴𝐴0
Y0 = E.𝐴𝐴̅1.𝐴𝐴̅0
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:
A1 A0 E
Y3
Y2
Y1
Y0
Subhajit Saha, Dept. of Computer Science Rajganj College
Therefore, the outputs of 2 to 4 decoder are nothing but the min
terms of two input variables A1 & A0, when enable, E is equal to one.
If enable, E is zero, then all the outputs of decoder will be equal
to zero.
BCD to Seven-Segment Decoder
BCD to 7-segment display decoder is a special decoder which can
convert binary coded decimals into another form which can be easily
displayed through a 7-segment display.
BCD stands for binary coded decimal. It is a digital numbering
system in which we can represent each decimal number using 4 bits of
binary numbers. There are 10 digits in the decimal system. To
represent all 10 digits we need 10 combinations of 4 binary bits.
A digital system like a computer can understand and easily read a
large number in binary format. However, a human cannot read large
binary numbers. To solve this problem we need to display it as a
decimal digit using the 7-segment display.
7-Segment Display
It is a digital device that can be used for displaying decimal numbers,
alphabets, and characters.
f b
e c
The 7-Segment display contains 7 LED segments arranged in a shape
given in the figure above. Generally, there are 8 input pins in a 7-
Segment display. 7 input pins for each of the 7 LEDs and one pin for
the common terminal.
Subhajit Saha, Dept. of Computer Science Rajganj College
a a
D
b
f b
C c
g
d
B
e e c
A f
g d
Circuit LED Display
DECIMAL BINARY NUMBERS SEVEN SEGMENT DISPLAY
NUMBER
D.N. A B C D a b c d e f g
0 0 0 0 0 1 1 1 1 1 1 0
1 0 0 0 1 0 1 1 0 0 0 0
2 0 0 1 0 1 1 0 1 1 0 1
3 0 0 1 1 1 1 1 1 0 0 1
4 0 1 0 0 0 1 1 0 0 1 1
5 0 1 0 1 1 0 1 1 0 1 1
6 0 1 1 0 1 0 1 1 1 1 1
7 0 1 1 1 1 1 1 0 0 0 0
8 1 0 0 0 1 1 1 1 1 1 1
9 1 0 0 1 1 1 1 1 0 1 1
Karnaugh Maps Simplification
For other combinations of input, the output is “don’t care X” as
there are no more digits to display. We will derive the expression
for each output using Karnaugh map (K-MAP).
Subhajit Saha, Dept. of Computer Science Rajganj College
For Output a: For Output b:
00 01 11 10 00 01 11 10
00 1 0 1 1 00 1 1 1 1
01 0 1 1 1 01 1 0 1 0
11 X X X X 11 X X X X
10 1 1 X X 10 1 1 X X
� 𝑫𝑫
a = A + C + BD + 𝑩𝑩 � �𝑫𝑫
� + 𝑪𝑪
b = 𝑩𝑩 � + CD
For Output c: For Output d:
00 01 11 10 00 01 11 10
00 1 1 1 0 00 1 0 1 1
01 1 1 1 1 01 0 1 0 1
11 X X X X 11 X X X X
10 1 1 X X 10 1 1 X X
�+D
c = B + 𝑪𝑪 � 𝑫𝑫
d = A + 𝑩𝑩 � + 𝑩𝑩
� C + C𝑫𝑫 �D
� + B𝑪𝑪
For Output e: For Output f:
00 01 11 10 00 01 11 10
00 1 0 0 1 00 1 0 0 0
01 0 0 0 1 01 1 1 0 1
11 X X X X 11 X X X X
10 1 0 X X 10 1 1 X X
� 𝑫𝑫
e = 𝑩𝑩 � + C𝑫𝑫
� � + B𝑫𝑫
f = A + B𝑪𝑪 � 𝑫𝑫
� + 𝑪𝑪 �
Subhajit Saha, Dept. of Computer Science Rajganj College
For Output g:
00 01 11 10
00 0 0 1 1
01 1 1 0 1
11 X X X X
10 1 1 X X
� + 𝑩𝑩
g = A + B𝑪𝑪 � C + C𝑫𝑫
�
Logical Circuit Diagram:
A B C D
Application of BCD to Display Decoder
• This circuit can be used as a timer circuit.
• With little modification, it can be also used to display the
number clock pulses.
• It can also be used with modification to display alphabet
display system instead of decimal display system.
Subhajit Saha, Dept. of Computer Science Rajganj College
• 7-Segment display are mostly used in digital clocks,
electronic meters, odometers as well as LCD application due
to low current consumption.
• They are also used in various measuring instruments, digital
watches and digital counters
Advantages of BCD to Display Decoder
Diminished Part Count: Limits the quantity of parts expected
to control a 7-portion show.
Further developed Dependability: Gives a strong and solid
change from BCD to show portions.
Simplicity of Mix: Smoothes out the method involved with
incorporating mathematical presentations into advanced
frameworks.
Disadvantages of BCD to Display Decoder
• Cost for Straightforward Applications: Utilizing a dedicated
decoder IC may be more costly than less complex answers for
essential necessities.
• Speed Limits: Execution is limited by the decoder’s handling
speed, which is inadmissible for fast applications.
• Size Imperatives: The actual size of the decoder IC may not
fit in minimized plans.
Applications of Decoders
Decoders are used in the cases where an output or a collection of
outputs is to be activated only on the occurrence of a particular
combination of input codes. Some important applications of decoders
are listed below −
• Decoders are used for code conversions.
• Decoders are extensively used in memory systems of computers.
• Decoders are also used for de-multiplexing or data distribution.
• Decoders are also used in data routing applications where very
short propagation delay is required.
• Decoder may also be used for timing or sequencing purposes.
• Decoders are also utilized to turn on and off digital devices at
a specific time.
Subhajit Saha, Dept. of Computer Science Rajganj College
Encoder
An Encoder is a combinational circuit that performs the reverse
operation of Decoder. It has maximum of 2n input lines and ‘n’
output lines. It will produce a binary code equivalent to the input,
which is active High. Therefore, the encoder encodes 2n input lines
with ‘n’ bits. It is optional to represent the enable signal in
encoders.
Block diagram of Encoder
2n data inputs
n data outputs
Encoder
4 to 2 Encoder:
The 4 to 2 Encoder has four inputs Y3, Y2, Y1 & Y0, and two outputs A1
& A0. The block diagram of the 4 to 2 Encoder is shown in the
following figure:
Y3
Y2 4 to 2 A1
Y1 Encoder A0
Y0
At any time, only one of these 4 inputs can be ‘1’ in order to get
the respective binary code at the output. The Truth table of 4 to 2
encoder is shown below:
Subhajit Saha, Dept. of Computer Science Rajganj College
Inputs Outputs
Y3 Y2 Y1 Y0 A1 A0
0 0 0 1 0 0
0 0 1 0 0 1
0 1 0 0 1 0
1 0 0 0 1 1
From Truth Table, we can write the Boolean functions for each output
as
A1 = Y3 + Y2
A0 = Y3 + Y1
We can implement the above two Boolean functions by using two input
OR gates. The circuit diagram of the 4 to 2 encoder is shown in the
following figure:
Y3
A1
Y2
A0
Y1
The above circuit diagram contains two OR gates. These OR gates
encode the four inputs with two bits.
Applications of 4 to 2 Encoder
The 4 to 2 Encoder is widely used in the following applications:
Data multiplexing, Generating digital control signals, Address
decoding applications, Encoding data in digital systems, etc.
Subhajit Saha, Dept. of Computer Science Rajganj College
Octal to Binary Encoder (8 X 3 Lines Encoder)
Octal to binary Encoder has eight inputs Y7 to Y0 and three outputs
A2, A1 & A0. Octal to binary encoder is nothing but 8 to 3 encoder.
The block diagram of octal to binary Encoder is shown in the
following figure:
Y7
Y6 Octal
Y5 A2
To
Y4 A1
Y3 Binary A0
Y2 Encoder
Y1
Y0
At any time, only one of these eight inputs can be ‘1’ in order to
get the respective binary code. The Truth table of octal to binary
encoder is shown below:
Inputs Outputs
Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 A2 A1 A0
0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0 0 0 1
0 0 0 0 0 1 0 0 0 1 0
0 0 0 0 1 0 0 0 0 1 1
0 0 0 1 0 0 0 0 1 0 0
0 0 1 0 0 0 0 0 1 0 1
0 1 0 0 0 0 0 0 1 1 0
1 0 0 0 0 0 0 0 1 1 1
Subhajit Saha, Dept. of Computer Science Rajganj College
From Truth table, we can write the Boolean functions for each output
as
A2 = Y7 + Y6 + Y5 + Y4
A1 = Y7 + Y6 + Y3 + Y2
A0 = Y7 + Y5 + Y3 + Y1
We can implement the above Boolean functions by using four input OR
gates. The circuit diagram of octal to binary encoder is shown in
the following figure:
Y7
Y6 A2
Y5
Y4
Y3 A1
Y2
A0
Y1
The above circuit diagram contains three 4-input OR gates. These OR
gates encode the eight inputs with three bits.
Applications of Octal to Binary Encoder
The octal to binary encoder is used in the following
applications −
• Data conversion in digital systems.
Subhajit Saha, Dept. of Computer Science Rajganj College
• Conversion of octal memory addresses into binary memory
addresses.
• In microprocessors and microcontrollers, to convert octal
instructions into binary format.
• In communication systems, to encode octal data into
binary form for transmission, etc.
Decimal to BCD Encoder
Decimal to BCD Encoder has ten inputs Y9 to Y0 and four outputs A, B,
C & D. The block diagram of decimal to BCD Encoder is shown in the
following figure:
Y0
Y1 A
Y2 Decimal
Y3 B
To
Y4
Y5 BCD C
Y6
Y7
Encoder D
Y8
Y9
At any time, only one of these ten inputs can be ‘1’ in order to get
the respective binary code. The Truth table of the Decimal to BCD
encoder is shown below:
Inputs Outputs
Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Y9 A B C D
1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 0 0 0 1 0
Subhajit Saha, Dept. of Computer Science Rajganj College
Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Y9 A B C D
0 0 0 1 0 0 0 0 0 0 0 0 1 1
0 0 0 0 1 0 0 0 0 0 0 1 0 0
0 0 0 0 0 1 0 0 0 0 0 1 0 1
0 0 0 0 0 0 1 0 0 0 0 1 1 0
0 0 0 0 0 0 0 1 0 0 0 1 1 1
0 0 0 0 0 0 0 0 1 0 1 0 0 0
0 0 0 0 0 0 0 0 0 1 1 0 0 1
From the Truth table, we can write the Boolean functions for each
output as
A = Y8 + Y9
B = Y4 + Y5 + Y6 + Y7
C = Y2 + Y3 + Y6 + Y7
D = Y1 + Y3 + Y5 + Y7 + Y9
We can implement the above Boolean functions by using OR gates. The
circuit diagram of the decimal to BCD encoder is shown in the
following figure:
Y9
A
Y8
Y7
Y6 B
Y5
Y4
Y3
C
Y2
Y1
The above circuit diagram contains one 5-input OR gate, two 4-input
OR gates, and one 1-input OR gate. These OR gates encode the ten
inputs with four bits.
Subhajit Saha, Dept. of Computer Science Rajganj College
Applications of Decimal to BCD Encoder
Decimal to BCD encoders find their application in digital
clocks and timers, data processing devices and storage
systems, calculators, measuring instruments, display
devices, microprocessors, microcontrollers, embedded
systems, etc.
Applications of Encoders
Data Compression: Encoders reduce the number of bits required to
represent a piece of information, aiding in data compression and
storage optimization.
Digital Circuit Design: Encoders are used to convert input
signals into binary form, facilitating the design of digital
systems and circuits, including multiplexers and demultiplexers.
Communication Systems: Encoders are used in data transmission
systems to encode information into formats suitable for
communication protocols, such as Manchester encoding in Ethernet.
Control Systems: In control systems, encoders are used to
generate binary codes for controlling machinery, robots, or
industrial systems.
Signal Processing: Encoders are utilized in digital signal
processing to encode data into formats that are more efficient
for processing and transmission.
Memory Address Decoding: Encoders are integral in memory address
decoding to map a physical address to a particular memory
location in computing systems.
Barcode and QR Code Readers: Encoders are used in barcode and QR
code readers to convert scanned data into digital information for
further processing.
Data Routing: The encoders are used in communication systems for
data routing. The encoder helps the data to be passed through the
link with small bandwidth and further, the data can be decoded
once reached to the desired destination.
Subhajit Saha, Dept. of Computer Science Rajganj College