Chapter 6 Code Converter

Page 1

Chapter 6 Code Converter Encoders Decoders


Objectives • At the end of this chapter, students should be able to:– Differentiate between encoder and decoder. – Apply a decimal-to-BCD priority encoder in a simple keyboard application. – Identify a decoder application. – Use BCD-to-7-segment decoders in display systems.

2


Introduction • Code conversion is a process to convert from one code to another (eg. decimal-to-BCD, binary-to-sevensegment display). • For example, code conversion take place each time a key is pressed on a computer keyboard, telephone and microwave oven keypad or any other similar devices where input values are entered into a system for processing. • It is done by a code converter circuit such as encoder and decoder. 3


Code Converter Circuit Example

Consider the block diagram of a Simple Calculator Translate decimal number to BCD code

789 456 123 0

Encoder

Processor

Translate the binary code to a 7-segment display

Decoder

Keypad

CPU performs operation in binary

7-segment display

4


Encoder • Encoder is a digital circuit that converts information to a coded form. • Examples: Decimal-to-BCD encoder (10:4) 8-line-to-3-line encoder (8:3)

5


Decimal-to-BCD Encoder • The function of this encoder is to translate a decimal input to a BCD number. • It converts only one input at a time into a BCD code. Logic Symbol

Decimal input

0 1 2 3 4 5 6 7 8 9

A B C D

MSB

BCD output LSB

6


Decimal-to-BCD Encoder Example

Design a 10:4 encoder, where only one input is active at one time. Truth Table

Input

Boolean Expression

Output

0

1

2

3

4

5

6

7

8

9 A B C D

1

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

0

0

0

0

0

0

0

0

0

0

0

1

0

0

1

0

0

0

0

0

0

0

0

0

1

0

0

0

0

1

0

0

0

0

0

0

0

0

1

1

0

0

0

0

1

0

0

0

0

0

0

1

0

0

0

0

0

0

0

1

0

0

0

0

0

1

0

1

0

0

0

0

0

0

1

0

0

0

0

1

1

0

0

0

0

0

0

0

0

1

0

0

0

1

1

1

0

0

0

0

0

0

0

0

1

0

1

0

0

0

0

0

0

0

0

0

0

0

0

1

1

0

0

1

A 89 B  4567 C  2  3 6  7 D  1 3  5  7  9

7


Decimal-to-BCD Encoder Logic Circuit 1 2 3 4 5 6 7 8 9

A

B

C

A 89 B  4567 C  2  3 6  7 D  1 3  5  7  9

D

8


Decimal-to-BCD Priority Encoder • Also known as 1o:4 priority encoder. • It will produce a BCD output corressponding to the highestorder decimal digit input that is active and will ignore any other lower-order active inputs. • For example, when both 3 and 6 inputs are activated, the BCD output is 0110 (which represents decimal 6). Logic Symbol

7414 7

I9 I8 I7 I6 I5 I4 I3 I2 I1

A3 A2 A1 A0

9


Decimal-to-BCD Priority Encoder Truth Table Input

Output

0

1

2

3

4

5

6

7

8

9

A

B

C

D

X

0

0

0

0

0

0

0

0

0

0

0

0

0

X

1

0

0

0

0

0

0

0

0

0

0

0

1

X

X

1

0

0

0

0

0

0

0

0

0

1

0

X

X

X

1

0

0

0

0

0

0

0

0

1

1

X

X

X

X

1

0

0

0

0

0

0

1

0

0

X

X

X

X

X

1

0

0

0

0

0

1

0

1

X

X

X

X

X

X

1

0

0

0

0

1

1

0

X

X

X

X

X

X

X

1

0

0

0

1

1

1

X

X

X

X

X

X

X

X

1

0

1

0

0

0

X

X

X

X

X

X

X

X

X

1

1

0

0

1

10


Decimal-to-BCD Priority Encoder Boolean Expression

A  8.9  9 B  4.5.6.7.8.9  5.6.7.8.9  6.7.8.9  7.8.9 C  2.3.4.5.6.7.8.9  3.4.5.6.7.8.9  6.7.8.9  7.8.9 D  1.2.3.4.5.6.7.8.9  3.4.5.6.7.8.9  5.6.7.8.9  7.8.9  9 Simplified Boolean Expression

A  89 B  4.8.9  5.8.9  6.8.9  7.8.9 C  2.4.5.8.9  3.4.5.8.9  6.8.9  7.8.9 D  1.2.4.6.8  3.4.6.8.  5.6.8  7.8  9 11


Decoder • Decoder is a combinational logic circuit that perform a “reverse” encoder function. • Examples: BCD-to-Decimal decoder (4:10) BCD-to-7-segment decoder

12


BCD-to-Decimal Decoder • BCD-to-decimal decoder converts each BCD code into one of ten possible digit indications. • For example, a BCD 0011 input would activate the 3 output. • Also known as 4-line-10-line decoder or a 1-of-10 decoder. Logic Symbol

0 1 2 A

BCD input

3

B

4:10

4

C

Decoder

5

D

Decimal output

6 7 8 9

13


BCD-to-Decimal Decoder Example

Design a BCD-to-decimal decoder.

Boolean Expression

Truth Table

0  A.B.C.D

Input A B C D 0

Output 1 2 3 4 5 6 7 8 9

0

0

0

0

1

0

0

0

0

0

0

0

0

0

2  A.B.C.D

0

0

0

1

0

1

0

0

0

0

0

0

0

0

3  A.B.C.D

0

0

1

0

0

0

1

0

0

0

0

0

0

0

0 0 0 0 0 1 1

0 1 1 1 1 0 0

1 0 0 1 1 0 0

1 0 1 0 1 0 1

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

1 0 0 0 0 0 0

0 1 0 0 0 0 0

0 0 1 0 0 0 0

0 0 0 1 0 0 0

0 0 0 0 1 0 0

0 0 0 0 0 1 0

0 0 0 0 0 0 1

4  A.B.C.D

1  A.B.C.D

5  A.B.C.D 6  A.B.C.D 7  A.B.C.D 8  A.B.C.D 9  A.B.C.D 14


BCD-to-Decimal Decoder A

Logic Circuit

B

C

D A'

0

B' C'

1

D' 2

3

4

5

6

7

8

9

0  A.B.C.D 1  A.B.C.D 2  A.B.C.D 3  A.B.C.D 4  A.B.C.D 5  A.B.C.D 6  A.B.C.D 7  A.B.C.D 8  A.B.C.D 9  A.B.C.D 15


BCD-to-7-Segment Decoder • The common output display is a 7-segment display decoder. f e

a b g d

c

• The BCD-to-7-segment decoder accepts the BCD code on its inputs and provides outputs to drive 7-segment display devices to produce a decimal readout.

16


BCD-to-7-Segment Decoder Example A

a b

B

c

C D

Sevensegment decoder

f

d

a

b

g

e f g

e

c d

If the input to the decoder are 0011, the 7-segment display device will activate segment a, b, c, d and g to display the number 3.

17


BCD-to-7-Segment Decoder Truth Table

A

Input B C

b

Output c d e

D

a

f

g

0

0

0

0

1

1

1

1

1

1

0

0

0

0

1

0

1

1

0

0

0

0

0

0

1

0

1

1

0

1

1

0

1

0

0

1

1

1

1

1

1

0

0

1

0

1

0

0

0

1

1

0

0

1

1

0

1

0

1

1

0

1

1

0

1

1

0

1

1

0

1

0

1

1

1

1

1

0

1

1

1

1

1

1

0

0

0

0

1

0

0

0

1

1

1

1

1

1

1

1

0

0

1

1

1

1

1

0

1

1 18


Decoder Applications • A two variable Boolean expression for Y  A.B  A.B  A.B can be constructed using a 2:4 decoder and an OR gate. Y  A.B  A.B  A.B   (3,2,0)

0 1 2 3

A B

A.B A.B

Y

A.B A.B

• A three variable Boolean expression can be constructed using a 3:8 decoder and an OR gate. Y  A.B  A.B.C  A.B.C  A.B(C  C)  A.B.C  A.B.C  A.B.C  A.B.C  A.B.C  A.B.C

 (4,5,6,7)

A B C

0 1 2 3 4 5 6 7

Y

19


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.