code converters, multiplexers and demultiplexers
TRANSCRIPT
Code Converters, Multiplexers and Demultiplexers
Introduction
• Information, or data, that is used by digital devices comes in many formats. The mechanisms for the conversion, transfer, and selection of data are handled by combinational logic ICs.
COMPARATORS
• A device used to compare the magnitude or size of two binary bit strings or words.
• The basic comparator evaluates two binary strings bit by bit and outputs a 1 if they are exactly equal.
• An XNOR gate is the easiest way to compare the equality of bits ( 0-0 or 1-1 x=1)
Binary comparator for comparing two 4-bit binary strings
A0
B0
A1
B1
A2
B2
A3
B3
Out = 1 if
A0 =B0
A1 = B1
A2 = B2
A3 = B3
Comparators
• Integrated –circuit magnitude comparators are available in both TTL and CMOS families.
• A magnitude comparator not only determines if A equals B but also if A is greater than B or A is less than B.
• The 7485 is a TTL 4-bit magnitude comparator.
7485 TTL comparator
Magnitude comparison of two 8-bit binary strings (binary words)
8-bit comparison outputs
DECODING
• Process of converting some codes (binary, BCD, or hex) into a singular active output representing its numeric value.
• Decoder – a device that converts a digital code such as hex or octal into a single output representing its numeric value
BCD decoder example
3-bit Binary-to-Octal DecodingTruth table for an Octal Decoder
(a) Active-HIGH outputs
Input Output
22 21 20 0 1 2 3 4 5 6 7
0 0 0 1 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0
1 0 1 0 0 0 0 0 1 0 0
1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1
3-bit Binary-to-Octal DecodingTruth table for an Octal Decoder
(b) Active-LOW outputs
Input Output
22 21 20 0 1 2 3 4 5 6 7
0 0 0 0 1 1 1 1 1 1 1
0 0 1 1 0 1 1 1 1 1 1
0 1 0 1 1 0 1 1 1 1 1
0 1 1 1 1 1 0 1 1 1 1
1 0 0 1 1 1 1 0 1 1 1
1 0 1 1 1 1 1 1 0 1 1
1 1 0 1 1 1 1 1 1 0 1
1 1 1 1 1 1 1 1 1 1 0
3-bit Binary-to-Octal Decoding
Decoder ICs
• IC decoder chips provide basic decoding as well as several other useful functions.
• Manufacturer’s data books list several decoders and give function tables illustrating the input/output operation and special functions.
• Rather than designing decoders using combinational logic, it is much more practical to be able to use a data book to find a decoder that you need and to determine the proper pin connections and operating procedure to perform a specific decoding task.
Decoder ICs
• Some of popular TTL decoder ICs
Device Number Function
74138 1-of-8 octal decoder (3-line-to-8-line)
7442 1-of-10 BCD decoder (4-line-to-10-line)
74154 1-of-16 hex decoder (4-line-to-16-line)
7447 BCD-to-seven-segment decoder
ENCODING
• Encoder – a device that converts a weighted numeric input line to an equivalent digital code, such as hex or octal.
• Encoding – used to generate a coded output (such as BCD or binary) from a singular active numeric input line.
Encoders
Typical block diagrams for encoders:
a. decimal-to-BCD encoder; b. octal-to-binary encoder
Binary outputs
Decimal-to BCD encoder truth tableDecimal
InputBCD output
D C B A
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
Basic decimal-to-BCD encoder
CODE CONVERTERS
• Code converter – a device that converts one type of binary representation to another, such as BCD to binary or binary to Gray code.
• BCD is very important for visual display communication between a computer and human beings. But BCD is very difficult to deal with arithmetically.
• Algorithms, or procedures, have been developed for the conversion of BCD to binary by computer programs (software) so that the computer will be able to perform all arithmetic operations in binary.
• Another way to convert BCD to binary, the hardware approach, is with MSI ICs. Additional circuitry is involved, but it is much faster to convert using hardware than software. (74184)
BCD-to-Binary Conversion
• If you are going to convert BCD to binary using software program statements, you would first have to develop a procedure, or algorithm, for the conversion.
BCD-to-Seven-Segment Converters
• Calculators and other devices with numeric displays use another form of code conversion involving BCD-to-seven-segment conversion.
• The term seven segment comes from the fact that these displays utilize seven different illuminating segments to make up each of the 10 possible numeric digit.
• A code converter must be employed to convert the 4-bit BCD into a 7-bit code to drive each digit.
• A commonly used BCD-to-seven-segment converter is the 7447 IC.
Gray Code
• Gray code – a binary coding system used primarily in rotating machinery to indicate shaft position. Each successive binary string within the code changes by only 1 bit.
• It is used primarily for indicating the angular position of a shaft on rotating machinery, such as automated lathes and drill presses.
• This code is like binary in that it can have as many bits as necessary, and the more bits, the more possible combinations of output codes (number of combinations = 2N).
• A 4-bit Gray code, for example, has 24 = 16 different representations, giving a resolution of 1 out of 16 possible angular positions at 22.5° each (360/16 = 22.5).
Four-Bit Gray Code
Gray Code Conversions
• The determination of the Gray code equivalents and the conversions between Gray code and binary code are done very simply with XOR gates.
Binary-to-Gray code converter Gray code-to-Binary converter
MULTIPLEXERS
• Multiplexer – a device or circuit capable of selecting one of several data input lines for output to a single line; sometimes referred to as data selector.
• It is capable of funneling several data lines into a single line for transmission to another point.
• The multiplexer has two or more digital input signals connected to its input.
• Control signal are also input to tell which data-input line to select fro transmission (data selection).
Functional diagram of a 4-line multiplexer
Logic diagram for a 4-line multiplexer
TTL and CMOS Multiplexers
Function Device Logic Family
Quad two-input 74157 TTL
74HC157 H-CMOS
4019 CMOS
Dual eight-input 74153 TTL
74HC153 H-CMOS
4539 CMOS
Eight-input 74151 TTL
74HC151 H-CMOS
4512 CMOS
Sixteen-input 74150 TTL
Providing Logic Functions with a Multiplexer
• Multiplexers have many other uses besides functioning as data selectors. Another important role of a multiplexer is for implementing combinational logic circuits.
• One multiplexer can take the place of several Small-Scale Integration (SS) logic gates.
Providing Combinational Logic Functions with a Multiplexer
DEMULTIPLEXERS
• Demultiplexer – a device or circuit capable of routing a single data-input line to one of several data-output lines; sometimes referred to as data distributor.
• It is the opposite procedure from multiplexing. It takes a single input data value and routes it to one of several outputs.
Functional diagram of a 4-line demultiplexer
The 74139 dual 4-line demultiplexer
Connections to route an input data signal to the 2a output of a 74139
Analog Multiplexer/Demultiplexer
• Several MUX/DEMUX are available in the CMOS family.
• The 4051, 4052, and 4053 are combination multiplexer and demultiplexer CMOS ICs.
• They can function in either configuration because their inputs and outputs are bidirectional, meaning that the flow can go in either direction.
• Also, they are analog, meaning that they can input and output levels other than just 1 and 0. The I/O levels can be any analog voltage between the positive and negative supply levels.
The 4051 CMOS analog
multiplexer/demultiplexer