eet 1131 unit 8 code converters, multiplexers, and demultiplexers

34
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.

Upload: halil

Post on 08-Feb-2016

90 views

Category:

Documents


2 download

DESCRIPTION

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. Types of Chips. Here are the kinds of chips we’ll study in coming weeks: Comparators - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

EET 1131 Unit 8Code 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.

Page 2: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

Types of Chips Here are the kinds of chips we’ll study in the

coming weeks: Comparators Decoders Encoders Chapter 8 Code converters Multiplexers Demultiplexers Latches & Flip-flops Chapter 10 Counters Chapter 12 Shift registers Chapter 13 Multivibrators Chapter 14 Memory Chapter 16

Page 3: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

Types of Chips (Continued)

For each type of chip listed on previous slide, you should understand:1. What that type of chip does, and why it’s

useful.2. How you could build such a circuit out of gates.3. Specific details of actual chips in each

category.

Page 4: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

ComparatorsThe 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.A1

B1

A2

B2

A3

B3

A4

B4

Output

Page 5: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

ComparatorsIC 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.

Outputs

A1

A0

A2A3

B1

B0

B2B3

Cascading inputs

COMP

A = BA < B

A > BA = BA < B

A > B

0

0

3

3

A

B The IC shown is the 4-bit 7485.

Page 6: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

ComparatorsIC comparators can be expanded using the cascading inputs as shown. The lowest order comparator has a HIGH on the A = B input.

Outputs

A1

A0

A2A3

B1

B0

B2B3

COMP

A = BA < B

A > BA = BA < B

A > B

0

0

3

3

A

B

A5

A4

A6A7

B5

B4

B6B7

+5.0 V

COMP

A = BA < B

A > BA = BA < B

A > B

0

0

3

3

A

B

LSBs MSBs

Page 7: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

Comparator Chip

7485 Four-bit magnitude comparator

Page 8: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

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”).

Page 9: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

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: 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.

Page 10: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

Example: 74154 Decoder

From Floyd, p. 306 From Texas Instrument datasheet

Page 11: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

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).

Page 12: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

DecodersA 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.

A1

A0

A2

A3

X

Active HIGH decoder for 0011

A1

A0

A2

A3

X

Active LOW decoder for 0011

Page 13: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

Decoders

A0 = 0

A1 = 1

A2 = 0

A3 = 1

1

Assume the output of the decoder shown is a logic 1. What are the inputs to the decoder?

Page 14: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

© 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

A0

0123456789

101112131415

4-bit binaryinput

Decimaloutputs

A1A2A3

110

1111111111101111

1

For the input shown, what is the output?

Page 15: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

Decoders

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.

CS2

A1

A0

A2

A3

15

121314

1234

91011

5678

0

&

48

12

CS1

X/Y

EN

74154

Page 16: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

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

Page 17: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

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

Page 18: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

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: 74LS42

Page 19: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

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.

A1

A0

A2

A3

1

2

3

45678

9

Page 20: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

Encoders

A1

A0

A2

A3

Show how 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

2

3

45678

9

0

0

0

00

0

0

0

1

0

0

1

1

Page 21: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

EncodersThe 74147 is an example of an IC encoder. It is has ten active-LOW inputs and converts the active input to an active-LOW BCD output.

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.

Decimal input

BCD output

1248

(16)

(11)(12)(13)(1)(2)

(4)(3)

(5)

(9)(7)(6)(14)

(8)

12345678

(10) 9

GND

VCC

HPRI/BCD

74HC147

The next slide shows an application …

Page 22: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

EncodersVCC

BCD complement of key press

123456789

1248

987

65

321

0

4

R7 R8 R9

R4 R5 R6

R1 R2 R3

R0

Keyboard encoder HPRI/BCD

74HC147

The zero line is not needed by the encoder, but may be used by other circuits to detect a key press.

Page 23: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

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

Page 24: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

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

Page 25: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

Different Numeric Codes

Several different codes exist for using 1s and 0s to represent positive integers.

Standard binary code Example: In standard binary, 15 is 1111.

Binary-coded decimal (BCD) Example: In BCD, 15 is 0001 0101.

Gray code Example: In Gray code, 15 is 1000.

Page 26: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

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.

Page 27: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

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!

Page 28: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

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: 74184 BCD-to-binary and binary-to-BCD co

nverter Binary-to-Gray code or Gray-code-to-

binary converters (see next slide)

Page 29: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

Gray Code/Binary Converters

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

Page 30: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

MUX

12

0

3

10

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.

Multiplexers

Two select lines are shown here to choose any of the four data inputs.

Selectinputs

Data inputs

Data outputD1

D0

D2D3

S1

S0

Which data line is selected if S1S0 = 10?D2

1

0

Page 31: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

Some Multiplexer Chips

74150 (16-input MUX) 74151 (8-input MUX) 74153 (dual 4-input MUX) 74157 (quad 2-input MUX)

Page 32: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

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…

Demultiplexers

74LS138

Y1

Y2

Y3

Y4

Y5

Y6

Y7

Y0

DEMUX

AAA

0

1

2

GGG

1

2A

2B

Data select lines

Enable

inputs

Data outputs

Page 33: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

Determine the outputs, given the inputs shown.

Demultiplexers

74LS138

Y1

Y2

Y3

Y4

Y5

Y6

Y7

Y0

DEMUX

AAA

0

1

2

GGG

1

2A

2B

Data select lines

Enable

inputs

Data outputs

A0

Y0

Y1

Y2

Y3

Y4

Y5

Y6

Y7

A1

A2

G1

G2A

G2B

LOWLOWThe output logic is opposite to the input

because of the active-LOW convention. (Red shows the selected line).

Page 34: EET  1131 Unit 8 Code Converters, Multiplexers, and  Demultiplexers

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)