EET 1131 Unit 8 Code Converters Multiplexers and

  • Slides: 36
Download presentation
EET 1131 Unit 8 Code Converters, Multiplexers, and Demultiplexers ¡ ¡ ¡ Read Kleitz,

EET 1131 Unit 8 Code Converters, Multiplexers, and Demultiplexers ¡ ¡ ¡ Read Kleitz, Chapter 8, skipping Sections 8 -2 and 8 -4. Homework #8 and Lab #8 due in a week and a half. Quiz when Homework #8 is due.

Useful Building-Block Circuits ¡ Here are the kinds of digital circuits we’ll study in

Useful Building-Block Circuits ¡ Here are the kinds of digital circuits we’ll study in the rest of this course: l l l Comparators Decoders Encoders Code converters Multiplexers Demultiplexers Latches & Flip-flops Counters Shift registers Multivibrators Memory Chapter 8 Chapter 10 Chapter 12 Chapter 13 Chapter 14 Chapter 16

Some Representative Chips ¡ ¡ Many of the chips in Circuit Type Typical Chips

Some Representative Chips ¡ ¡ Many of the chips in Circuit Type Typical Chips the 7400 series Comparator 7485 contain circuits listed Decoder 7442, 74138, 74154 on the previous slide. Encoder 74147, 74148 In a sense these Code converter 7447, 74184 chips are obsolete, Multiplexer 74150, 74151, because new designs 74153, 74157 no longer use Demultiplexer 74138, 74139, 7400 -series chips. 74154 But these are typical of the kind of circuits that are still widely used as building blocks in digital systems.

Useful Building-Block Circuits (Continued) ¡ For each type of circuit listed on previous slide,

Useful Building-Block Circuits (Continued) ¡ For each type of circuit listed on previous slide, you should understand: 1. 2. 3. What type of circuit does, and why it’s useful. How you could build such a circuit out of gates. Specific details of actual chips in each category.

Comparators The function of a comparator is to compare the magnitudes of two binary

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. How could you test two 4 -bit numbers for equality? AND the outputs of four XNOR gates. A 1 B 1 A 2 B 2 Output A 3 B 3 A 4 B 4 © 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

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. A 0 A 1 A 2 A 3 Cascading inputs B 0 B 1 B 2 B 3 0 COMP A 3 A>B A=B A<B 0 B 3 Outputs The IC shown is the 4 -bit 7485. © 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

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 A 0 A 1 A 2 A 3 +5. 0 V B 0 B 1 B 2 B 3 MSBs 0 COMP A 3 A>B A=B A<B 0 B 3 A 4 A 5 A 6 A 7 B 4 B 5 B 6 B 7 0 COMP A 3 A>B A=B A<B 0 B Outputs 3 © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

Comparator Chip ¡ 7485 Four-bit magnitude comparator

Comparator Chip ¡ 7485 Four-bit magnitude comparator

Enable Pins ¡ ¡ Many of the chips we’ll study have enable inputs. Depending

Enable Pins ¡ ¡ Many of the chips we’ll study have enable inputs. Depending on the logic level at this pin, the chip is either enabled or disabled. When the chip is enabled, it performs its intended function and the outputs behave as you would expect. When the chip is disabled, then (usually) all outputs are forced to their inactive state, regardless of the other inputs to the chip. Common names for enable pins include EN, G (for “gate”), and CS (for “chip select”).

Active-High versus Active-Low Pins ¡ ¡ Each input pin and output pin on a

Active-High versus Active-Low Pins ¡ ¡ Each input pin and output pin on a chip is either active-high or active-low. In a logic symbol: l l ¡ ¡ Active-low pins are marked with a bubble or triangle. Active-high pins have no bubble or triangle. Active-high pins: the pin is active when there’s a HIGH on that pin. Many chips have active-low pins: the pin is active when there’s a LOW on that pin.

Example of a Chip With Enable Inputs and Some Active-Low Pins: 74154 Decoder From

Example of a Chip With Enable Inputs and Some Active-Low Pins: 74154 Decoder From Floyd, p. 306 From Texas Instrument datasheet

Decoders, Encoders, & Code Converters Decoders convert a binary code into a single active

Decoders, Encoders, & Code Converters Decoders convert a binary code into a single active output representing the code’s value. ¡ Encoders generate a coded output from a single active input line. ¡ Code converters take one input code (such as BCD) and convert it to another code (such as binary). ¡

Decoders A decoder is a logic circuit that detects the presence of a specific

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. A 0 A 1 A 0 X A 1 X A 2 A 3 Active HIGH decoder for 0011 Active LOW decoder for 0011 © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

Decoders Assume the output of the decoder shown is a logic 1. What are

Decoders Assume the output of the decoder shown is a logic 1. What are the inputs to the decoder? © 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

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. For the input shown, what is the output? © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

Decoders X/Y A specific integrated circuit decoder is the 74154, a 4 -to-16 decoder.

Decoders X/Y A specific integrated circuit decoder is the 74154, a 4 -to-16 decoder. It includes two active LOW chip select lines which must be at the active level to enable the outputs. These lines can be used to expand the decoder to larger inputs. A 0 A 1 A 2 A 3 CS 1 CS 2 EN 74154 © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

Octal Decoder 3 data input pins for input code. ¡ 8 output pins. ¡

Octal Decoder 3 data input pins for input code. ¡ 8 output pins. ¡ Also called 1 -of-8 decoder or 3 -line-to-8 -line decoder. ¡ May have other inputs and outputs too, such as enable inputs. ¡ Example chip: 74138 ¡

Hex Decoder 4 data input pins for input code. ¡ 16 output pins. ¡

Hex Decoder 4 data input pins for input code. ¡ 16 output pins. ¡ Also called 1 -of-16 decoder or 4 -line-to-16 -line decoder. ¡ May have other inputs and outputs too, such as enable inputs. ¡ Example chip: 74154 ¡

BCD Decoder 4 data input pins for input code. ¡ 10 output pins. ¡

BCD Decoder 4 data input pins for input code. ¡ 10 output pins. ¡ Also called 1 -of-10 decoder or 4 -line-to-10 -line decoder. ¡ May have other inputs and outputs too, such as enable inputs. ¡ Example chip: 7442 ¡

Encoders An encoder accepts an active logic level on one of its inputs and

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 A 0 A 1 A 2 A 3 © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

Encoders Show the BCD encoder converts the decimal number 3 into a BCD 0011.

Encoders Show the BCD encoder converts the decimal number 3 into a BCD 0011. The top two OR gates have ones as indicated with the red lines. Thus the output is 0011. 1 0 1 2 0 1 3 1 4 5 6 7 8 9 0 0 0 0 A 0 A 1 A 2 A 3 © 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

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 This device offers additional flexibility in that it is a priority encoder. This means that if more than one input is active, the one with the highest order decimal digit will be active. HPRI/BCD Decimal input BCD output 74 HC 147 The next slide shows an application … GND © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

VCC Encoders Keyboard encoder HPRI/BCD complement of key press 74 HC 147 The zero

VCC Encoders Keyboard encoder HPRI/BCD complement of key press 74 HC 147 The zero line is not needed by the encoder, but may be used by other circuits to detect a key press. © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

BCD Encoder 10 input pins. ¡ 4 output pins for output code. ¡ Also

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

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 ¡

Different Numeric Codes Several different codes exist for using 1 s and 0 s

Different Numeric Codes Several different codes exist for using 1 s and 0 s to represent positive integers. ¡ Standard binary code ¡ l ¡ Binary-coded decimal (BCD) l ¡ Example: In standard binary, 15 is 1111. Example: In BCD, 15 is 0001 0101. Gray code l Example: In Gray code, 15 is 1000.

Four-Bit Gray Code ¡ ¡ The key feature of Gray code is that only

Four-Bit Gray Code ¡ ¡ The key feature of Gray code is that only one bit changes when we increase a number by one. This is not true of standard binary.

Why is Gray Code Useful? ¡ ¡ Gray code is used for rotary encoders

Why is Gray Code Useful? ¡ ¡ Gray code is used for rotary encoders that sense the angular position of a shaft or axle. From Wikipedia article on rotary encoders: Standard 3 -bit binary code: no good! 3 -bit Gray code: better!

Code Converters If a digital system needs to handle numbers using two different codes,

Code Converters If a digital system needs to handle numbers using two different codes, it needs circuitry to convert between the two codes. ¡ Examples of code converters: ¡ l l 74184 BCD-to-binary and binary-to-BCD converter Binary-to-Gray code or Gray-code-tobinary converters (see next slide)

Gray Code/Binary Converters Figure 8 -40. Binary-to-Gray-code converter Figure 8 -41. Gray-code-to-binary converter

Gray Code/Binary Converters Figure 8 -40. Binary-to-Gray-code converter Figure 8 -41. Gray-code-to-binary converter

Multiplexer (MUX) and Demultiplexer (DEMUX) ¡ Select Inputs Data Inputs MUXes and DEMUXes are

Multiplexer (MUX) and Demultiplexer (DEMUX) ¡ Select Inputs Data Inputs MUXes and DEMUXes are basically just switch boxes that route data from one place to another. MUX Select Inputs Data Output A MUX routes one of its data inputs to its single data output. Data Input DEMUX Data Outputs A DEMUX routes its single data input to one of its data outputs.

Multiplexers A multiplexer, or “MUX, ” (also called a data selector) selects one of

Multiplexers A multiplexer, or “MUX, ” (also called a data selector) selects one of two or more data inputs and routes data from that selected input to the output. The particular data input that is selected is determined by the select inputs. Two select inputs are shown here to choose any of the four data inputs. Which data input is selected if S 1 S 0 = 10? D 2 Select inputs S 0 S 1 D 0 Data D 1 inputs D 2 D 3 0 1 Data output © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

Some Multiplexer Chips 74150 ¡ 74151 ¡ 74153 ¡ 74157 ¡ (16 -input MUX)

Some Multiplexer Chips 74150 ¡ 74151 ¡ 74153 ¡ 74157 ¡ (16 -input MUX) (8 -input MUX) (dual 4 -input MUX) (quad 2 -input MUX)

Demultiplexers A demultiplexer or “DEMUX” (also called a data distributor) performs the opposite function

Demultiplexers A demultiplexer or “DEMUX” (also called a data distributor) performs the opposite function from a MUX. It routes data from a data input to one of two or more data outputs, depending on the select inputs. The 74 LS 138 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 inputs. Note that the outputs are active. LOW as illustrated in the following example… Select inputs Enable inputs, one of which will serve as the data input. Data outputs 74 LS 138 © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

Demultiplexers Determine the outputs, given the inputs shown. The output logic is opposite to

Demultiplexers Determine the outputs, given the inputs shown. The output logic is opposite to the input because of the active-LOW convention. (Red shows the selected line). Select inputs Data outputs Data input Enable inputs 74 LS 138 A 0 A 1 A 2 G 1 G 2 A LOW G 2 B LOW Y 0 Y 1 Y 2 Y 3 Y 4 Y 5 Y 6 Y 7 © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

Some Demultiplexer Chips 74138 (3 -line to 8 -line Decoder/DEMUX) ¡ 74154 (4 -line

Some Demultiplexer Chips 74138 (3 -line to 8 -line Decoder/DEMUX) ¡ 74154 (4 -line to 16 -line Decoder/DEMUX) ¡ 74139 (dual 2 -line to 4 -line Decoder/DEMUX) ¡