Code Converters, Multiplexers, and Demultiplexers
Code Converters, Multiplexers, and Demultiplexers
Code Converters, Multiplexers, and Demultiplexers
Types of Chips
Comparators
Decoders
Encoders
Code converters
Multiplexers
Demultiplexers
Flip-flops
Counters
Shift registers
Multivibrators
Chapter 8
Chapter 10
Chapter 12
Chapter 13
Chapter 14
2.
3.
Comparators
The function of a comparator is to compare the magnitudes of two
binary numbers to determine the relationship between them. In the
simplest form, a comparator can test for equality using XNOR gates.
Example
Solution
Output
2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Comparators
IC comparators provide outputs to indicate which of the input
numbers is larger or if they are equal. Cascading inputs are provided
to expand the comparator to larger numbers.
A0
A1
A2
A3
Cascading
inputs
B0
B1
B2
B3
COMP
A
3
A>B A>B
A=B A=B
A<B A<B
0
B
3
Outputs
2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Comparators
IC comparators can be expanded using the cascading inputs as
shown. The lowest order comparator has a HIGH on the A = B input.
LSBs
A0
A1
A2
A3
+5.0 V
B0
B1
B2
B3
MSBs
0
COMP
A
3
A>B A>B
A=B A=B
A<B A<B
0
B
3
A4
A5
A6
A7
B4
B5
B6
B7
COMP
A
3
A>B A>B
A=B A=B
A<B A<B
0
B
Outputs
2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Comparator Chip
Enable Pins
Decoders
A decoder is a logic circuit that detects the presence of a specific
combination of bits at its input. Two simple decoders that detect the
presence of the binary code 0011 are shown. The first has an active
HIGH output; the second has an active LOW output.
A0
A1
A0
X
A1
A2
A2
A3
A3
2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Decoders
Question
2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Decoders
IC decoders have multiple outputs to decode any
combination of inputs. For example the hex decoder
shown here has 16 outputs one for each combination of
binary inputs.
Bin/Dec
Question
1
1
0
1
A0
A1
A2
A3
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
Decimal
outputs
2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Decoders
X/Y
A0
A1
A2
A3
CS1
CS2
1
2
4
8
&
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
EN
74154
2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Octal Decoder
Hex Decoder
BCD Decoder
Encoders
An encoder accepts an active logic level on one of its
inputs and converts it to a coded output, such as BCD or
binary.
The basic logic diagram is shown.
This encoder has an input for each
decimal digit, and four outputs that
represent the binary code for the
active input digit.
There is no zero input because the
outputs are all LOW when the input
is zero.
1
2
3
4
5
6
7
8
9
A0
A1
A2
A3
2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Encoders
Example
Solution
2 0
1
3
4
5
6
7
8
9
0
0
0
0
A0
A1
A2
A3
2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Encoders
The 74147 is an example of an IC encoder. It is has ten
active-LOW inputs and converts the active input to an
V
active-LOW BCD output.
CC
(16)
(11)
(12)
(13)
(1)
Decimal
input
(2)
(3)
(4)
(5)
(10)
HPRI/BCD
1
2
3
4
5
6
7
8
9
74HC147
1
2
4
8
(9)
(7)
(6)
(14)
BCD
output
(8)
GND
2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
VCC
Encoders
Keyboard
encoder
R7
R8
R9
HPRI/BCD
R4
R5
R1
R2
R0
R6
R3
1
2
3
4
5
6
7
8
9
1
2
4
8
BCD complement of
key press
74HC147
BCD Encoder
10 input pins.
4 output pins for output code.
Also called 10-line-to-4-line
encoder.
May have other inputs and outputs
too, such as enable inputs.
Example chip: 74147
Octal Encoder
8 input pins.
3 output pins for output code.
Also called 8-line-to-3-line encoder.
May have other inputs and outputs
too, such as enable inputs.
Example chip: 74148
Gray code
Example:
Code Converters
Multiplexers
A multiplexer (MUX) selects one data line from two or
more input lines and routes data from the selected line to
the output. The particular data line that is selected is
determined by the select inputs.
Two select lines are shown
here to choose any of the
four data inputs.
Question
Which data line is selected
if S1S0 = 10?D2
Select
inputs
S0
S1
D0
Data D1
inputs D2
D3
0
1
MUX
0
1
0
1
2
3
Data
output
2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
74150
74151
74153
74157
(16-input MUX)
(8-input MUX)
(dual 4-input MUX)
(quad 2-input MUX)
Demultiplexers
A demultiplexer (DEMUX) performs the opposite function
from a MUX. It switches data from one input line to two or
more data lines depending on the select inputs.
The 74LS138 was introduced
previously as a decoder but can also
serve as a DEMUX. When
connected as a DEMUX, data is
applied to one of the enable inputs,
and routed to the selected output
line depending on the select
variables. Note that the outputs are
active-LOW as illustrated in the
following example
DEMUX
Data
select
lines
A0
A1
A2
Y
Y
Y
Y
Y
Y
Y
Enable
inputs
G1
G2A
G2B
Data
outputs
4
5
74LS138
2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Demultiplexers
Example
Solution
Data
select
lines
A0
A1
A2
Y
Y
Y
Y
Y
Y
Y
Enable
inputs
G1
G2A
G2B
4
5
74LS138
Data
outputs
A0
A1
A2
G1
G2A LOW
G2B LOW
Y0
Y1
Y2
Y3
Y4
Y5
Y6
Y7
2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved