Decoders
Module 44
LCST – Logic Circuits and Switching
th
Theory
Source: Digital Fundamentals by Floyd, T. 11 Edition
Module 44 - Decoders 1
Prepared by: fscjr.
Introduction
A decoder is a digital circuit that detects the presence of a
specified combination of bits (code) on its inputs and indicates
the presence of that code by a specified output level.
In its general form, a decoder has n input lines to handle n bits
and from one to 2n output lines to indicate the presence of one
or more n-bit combinations.
In this module, three fixed-function IC decoders are
introduced.
The basic principles can be extended to other types of
decoders.
Module 43-Comparators 2
Prepared by: fscjr.
Learning Objectives
After completing this module, the learners
should be able to:
1. Define decoder
2. Design a logic circuit to decode any combination of bits
3. Describe the 74HC154 binary-to-decimal decoder
4. Expand decoders to accommodate larger numbers of
bits in a code
5. Describe the 74HC42 BCD-to-decimal decoder
Module 43-Comparators 3
Prepared by: fscjr.
Learning Objectives cont’d
After completing this module, the learners
should be able to:
6. Describe the 74HC47 BCD-to-7-segment decoder
7. Discuss zero suppression in 7-segment displays
8. Use VHDL to describe various types of decoders
9. Apply decoders to specific applications
Module 43-Comparators 4
Prepared by: fscjr.
The Basic Binary Decoder
If a NAND gate is used in place of the AND gate in Figure 6–26,
a LOW output will indicate the presence of the proper binary
code, which is 1001 in this case.
Module 43-Comparators 5
Prepared by: fscjr.
The Basic Binary Decoder cont’d
EXAMPLE 6–8
Determine the logic required to decode the binary number 1011
by producing a HIGH level on the output.
Module 43-Comparators 6
Prepared by: fscjr.
The 3-Bit Decoder with active HIGH output
Module 43-Comparators 7
Prepared by: fscjr.
The 4-Bit Decoder
In order to decode all possible combinations of four bits, sixteen
decoding gates are required (2 = 16).
This type of decoder is commonly called either a 4-line-to-16-
line decoder because there are four inputs and sixteen outputs
or a 1-of-16 decoder because for any given code on the inputs,
one of the sixteen outputs is activated.
Module 43-Comparators 8
Prepared by: fscjr.
The 4-Bit Decoder cont’d
Module 43-Comparators 9
Prepared by: fscjr.
The 4-Bit Decoder cont’d
Module 43-Comparators 10
Prepared by: fscjr.
The 4-Bit Decoder cont’d
Module 43-Comparators 11
Prepared by: fscjr.
IMPLEMENTATION: 1-OF-16 DECODER
Fixed-Function Device
The 74HC154 is a good example of a fixed-function IC decoder.
The logic symbol is shown in Figure 6–29.
There is an enable function (EN) provided on this device, which is
implemented with a NOR gate used as a negative-AND.
A LOW level on each chip select input, CS1’ and CS2’, is required in order to
make the enable gate output (EN) HIGH.
The enable gate output is connected to an input of each NAND gate in the
decoder, so it must be HIGH for the NAND gates to be enabled.
If the enable gate is not activated by a LOW on both inputs, then all sixteen
decoder outputs (OUT) will be HIGH regardless of the states of the four input
variables, A0, A1, A2, and A3.
Module 43-Comparators 12
Prepared by: fscjr.
IMPLEMENTATION: 1-OF-16 DECODER cont’d
Module 43-Comparators 13
Prepared by: fscjr.
IMPLEMENTATION: 1-OF-16 DECODER cont’d
Programmable Logic Device (PLD)
The 1-of-16 decoder can be described using VHDL and
implemented as hardware in a PLD.
The decoder consists of sixteen 5-input NAND gates for
decoding, a 2-input negative-AND for the enable function, and
four inverters.
Module 43-Comparators 14
Prepared by: fscjr.
IMPLEMENTATION: 1-OF-16 DECODER cont’d
Programmable Logic Device (PLD)
The following VHDL program code uses the data flow approach.
Module 43-Comparators 15
Prepared by: fscjr.
IMPLEMENTATION: 1-OF-16 DECODER cont’d
Module 43-Comparators 16
Prepared by: fscjr.
IMPLEMENTATION: 1-OF-16 DECODER cont’d
EXAMPLE 6–9
A certain application requires that a 5-bit number be decoded.
Use 74HC154 decoders to implement the logic. The binary
number is represented by the format A4A3A2A1A0.
Module 43-Comparators 17
Prepared by: fscjr.
IMPLEMENTATION: 1-OF-16 DECODER cont’d
Module 43-Comparators 18
Prepared by: fscjr.
The BCD-to-Decimal Decoder
It is frequently referred as a 4-
line-to-10-line decoder or a 1-
of-10 decoder.
The method of implementation
is the same as for the 1-of-16
decoder previously discussed,
except that only ten decoding
gates are required because the
BCD code represents only the
ten decimal digits 0 through 9.
Module 43-Comparators 19
Prepared by: fscjr.
The BCD-to-Decimal Decoder cont’d
Fixed-Function Device
Module 43-Comparators 20
Prepared by: fscjr.
The BCD-to-Decimal Decoder cont’d
Programmable Logic Device (PLD)
Using the data flow approach, the VHDL program code for the 1-of-16
decoder can be simplified to implement the BCD-to-decimal decoder.
Module 43-Comparators 21
Prepared by: fscjr.
The BCD-to-Decimal Decoder cont’d
Programmable Logic Device (PLD)
Module 43-Comparators 22
Prepared by: fscjr.
The BCD-to-Decimal Decoder cont’d
EXAMPLE 6–10
If the input waveforms in Figure 6–32(a) are applied to the inputs of the
74HC42, show the output waveforms.
Module 43-Comparators 23
Prepared by: fscjr.
The BCD-to-Decimal Decoder
EXAMPLE 6–10
Module 43-Comparators 24
Prepared by: fscjr.
IMPLEMENTATION:
BCD-TO-7-SEGMENT DECODER/DRIVER cont’d
Fixed-Function Device
The 74HC47 is an example of
an IC device that decodes a
BCD input and drives a 7-
segment display.
Module 43-Comparators 25
Prepared by: fscjr.
IMPLEMENTATION:
BCD-TO-7-SEGMENT DECODER/DRIVER cont’d
Module 43-Comparators 26
Prepared by: fscjr.
IMPLEMENTATION:
BCD-TO-7-SEGMENT DECODER/DRIVER cont’d
Zero Suppression for a 4-Digit Display
Module 43-Comparators 27
Prepared by: fscjr.
IMPLEMENTATION:
BCD-TO-7-SEGMENT DECODER/DRIVER cont’d
Zero Suppression for a 4-Digit Display
Module 43-Comparators 28
Prepared by: fscjr.
Mastery Exercises
1. A 3-line-to-8-line decoder can be used for octal-to-decimal decoding.
When a binary 101 is on the inputs, which output line is activated?
2. How many 74HC154 1-of-16 decoders are necessary to decode a 6-bit
binary number?
3. Would you select a decoder/driver with active-HIGH or active-LOW
outputs to drive a common-cathode 7-segment LED display?
Module 43-Comparators 29
Prepared by: fscjr.