0% found this document useful (0 votes)
2 views38 pages

Chapter 7 - Code Converter

Uploaded by

Irfan Adri MN
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views38 pages

Chapter 7 - Code Converter

Uploaded by

Irfan Adri MN
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CHAPTER 7

CODE CONVERTER
LESSON OUTCOMES

 After complete this lesson, the students should be


able to:
 Understand the fundamentals of code conversion
 Design and implement code conversion circuits
 Differentiate between encoder and decoder
 Differentiate between simple encoder and priority
encoder
 Construct the Boolean expressions using a decoder
and OR gate
CODE CONVERTER

 A code converter is a combinational circuit that


translates data from one type of binary code into
another without altering the information's actual
value. These circuits are widely used in digital
systems to facilitate compatibility between
different coding schemes or devices.
 Code conversion :
 performed by encoder, decoder and code
converter circuits.
 required to operate the electronic displays that
show numbers or letters on calculators and clocks.
CODE CONVERTER
 E.g: the block diagram of calculator
 The input device is a keyboard.
 Between the keyboard and the CPU is an encoder - translates the
decimal number pressed on the keyboard into a binary code
such as BCD code.
 The CPU performs its operation in binary and puts out a binary
code.
 The decoder translates the binary code from the CPU to a seven-
segment display.
ENCODER

 Encoders are used in keyboard applications


where activation of a single key must produce a
unique binary code to represent its value.
 Encoders have several inputs, but it converts only
one input at a time into a binary code.
 Encoders are usually specified by the number of
inputs to outputs such as 4:2, 8:3 or 10:4 encoders.
ENCODER

 The job of the encoder in the calculator is to


translate a decimal input to a BCD number.
 A block diagram for a decimal-to-BCD or 10:4
encoder is shown below.

 The encoder has 10 inputs on


the left and 4 outputs on the
right.
 The encoder may have one
active input and produces a
unique output.
ENCODER

 The diagram show below is a truth table for a 10:4


encoder.
 If decimal input 4 is activated, the output in BCD is
0100.
ENCODER
 The output expressions and the logic circuit :
ENCODER

 Example 1:
 Design a 4:2 encoder, where only one input is
active at any one time.
Encoder

 The 4:2 encoder truth table can be written in full


as follows.
The output expressions and the logic
circuit:
Exercises
1. The block diagram shown below is an 8:3 encoder:

a) Derive the 8:3 encoder truth table


b) Write the Boolean expression for the outputs
c) Draw the logic circuit
Solution:
a) Truth table

Input Output
0 1 2 3 4 5 6 7 A B C
1 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 1 0
0 0 0 1 0 0 0 0 0 1 1
0 0 0 0 1 0 0 0 1 0 0
0 0 0 0 0 1 0 0 1 0 1
0 0 0 0 0 0 1 0 1 1 0
0 0 0 0 0 0 0 1 1 1 1
b) Boolean expressions
• A=4+5+6+7
• B=2+3+6+7
• C=1+3+5+7
c) Logic circuit
PRIORITY ENCODER

 The simple 10:4 encoder identifies a drawback


when more than one input is activated at one
time – produced incorrect output for either
activated input.
 Priority encoder includes the necessary logic to
ensure that when 2 or more inputs are activated,
the output code will correspond to the highest
numbered input.
 E.g: when both 3 and 5 are activated, the output
code will be 0101 (5).
PRIORITY ENCODER

 The 10:4 priority encoder with active-high inputs is


shown below:
PRIORITY ENCODER

 As an example, suppose any of the input 0, 1 or 2


is activated, the output is a BCD 0010.
 This is shown on the truth table as:

0 1 2 3 4 5 6 7 8 9 ABCD
XX1 0 0 0 0 0 0 0 0 0 1 0
which represent :

0 1 2 3 4 5 6 7 8 9 A B C D
0 0 1 0 0 0 0 0 0 0 0 0 1 0
0 1 1 0 0 0 0 0 0 0 0 0 1 0
1 0 1 0 0 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 0 0 1 0
PRIORITY ENCODER

 The output expressions can be written as:

 This can be further simplified as:


Priority Encoder

 Example 2:
 Design a 4:2 priority encoder:

 From the truth table, the expressions can be written


as :
simplified ->
Priority Encoder

 The 4:2 priority encoder truth table can be written


in full as follows:

The expressions can be simplified


using Karnaugh Map as:
Exercises
1. The block diagram shown below is an 8:3 priority encoder:

a) Derive the 8:3 priority encoder truth table


b) Write the Boolean expression for the outputs
c) Using Boolean algebra, simplify the expressions for A, B and C
Solution:
a) Truth table

Input Output
0 1 2 3 4 5 6 7 A B C
X 0 0 0 0 0 0 0 0 0 0
X 1 0 0 0 0 0 0 0 0 1
X X 1 0 0 0 0 0 0 1 0
X X X 1 0 0 0 0 0 1 1
X X X X 1 0 0 0 1 0 0
X X X X X 1 0 0 1 0 1
X X X X X X 1 0 1 1 0
X X X X X X X 1 1 1 1
b) Boolean expressions
• A = 4. 5. 6. 7 + 5. 6. 7 + 6. 7 + 7
• B = 2. 3. 4. 5. 6. 7 + 3. 4. 5. 6. 7 + 6. 7 + 7
• C = 1. 2. 3. 4. 5. 6. 7 + 3. 4. 5. 6. 7 + 5. 6. 7 + 7
c) Simplified expressions:
• A=4+5 +6 +7
• B = 2. 4. 5 + 3. 4. 5 + 6. 7 + 7
• C = 1. 2. 4. 6 + 3. 4. 6 + 5. 6 + 7
DECODER

 A decoder - the opposite of an encoder.


 A decoder translate from the BCD code to
decimals.
 The BCD codes form the input on the left of the
decoder, and the output lines are on the right.
 Only one output line will be activated at any one
time.
 A BCD 0011 input would activate the 3 output.
DECODER

 Example : 4:10 decoder


DECODER

 The output expressions and the logic circuit:


DECODER

 Example 1:
 Design a 2:4 decoder.
 A 2:4 decoder has 2 inputs and 4 outputs.

 The output expressions and the logic circuit:


Exercises
1. The block diagram shown below is an 3:8 decoder:

a) Derive the 3:8 decoder truth table


b) Write the Boolean expression for the outputs
c) Draw the logic circuit
Solution:
a) Truth table

Input Output
A B C 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
b) Boolean c) Logic circuit
expressions
• 0 = A. B. C
• 1 = A. B. C
• 2 = A. B. C
• 3 = A. B. C
• 4 = A. B. C
• 5 = A. B. C
• 6 = A. B. C
• 7 = A. B. C
DECODER APPLICATIONS

 We can construct a Boolean expression using a


decoder and logic gates.
 A two variable Boolean expression for 𝑌 = 𝐴. 𝐵 +
𝐴. 𝐵 + 𝐴. 𝐵 can be constructed using a 2:4
decoder and an OR gate.
DECODER APPLICATIONS

 A three variable Boolean expression can be


constructed using a 3:8 decoder and an OR gate.
Exercises
1. Draw the following expression using a decoder and an OR
gate
a) Y = A B⨁C + A. C + A. B. C
b) Y = B. C + A. D + A. C. D + A. B. C. D
c) Y = A. B. C. D + B. C. D + A(B. C + D)
Solution:
a) Y = A B⨁C + A. C + A. B. C
= A B. C + B. C + A. C(B + B) + A. B. C
= A . B. C + A. B. C + A. B. C + A. B. C + A. B. C
= 001 + 010 + 110 + 100 + 101
= σ(1,2,4,5,6)
Solution:
b) Y = B. C + A. D + A. C. D + A. B. C. D
= B. C A + A D + D + A. D B + B C + C + A. C. D(B + B) + A. B. C. D
= B. C A. D + A. D + A. D + A. D + A. D B. C + B. C + B. C + B. C + A. B. C. D +
A. B. C. D + A. B. C. D
= A. B. C. D + A. B. C. D + A. B. C. D + A. B. C. D + A. B. C. D + A. B. C. D +
A. B. C. D + A. B. C. D + A. B. C. D + A. B. C. D + A. B. C. D
= 1001 + 1000 + 0001 + 0000 + 0110 + 0100 + 0010 + 0000 + 1101 +
1001 + 1100
= σ(0,1,2,4,6,8,9,12,13)
Solution:
c) Y = A. B. C. D + B. C. D + A(B. C + D)
= A. B. C. D + B. C. D A + A + A. B. C(D + D) + A. D(B + B)(C + C)
= A. B. C. D + A. B. C. D + A. B. C. D + A. B. C. D + A. B. C. D +
A. D B. C + B. C + B. C + B. C
= A. B. C. D + A. B. C. D + A. B. C. D + A. B. C. D + A. B. C. D + A. B. C. D +
A. B. C. D + A. B. C. D + A. B. C. D
= 1000 + 1001 + 0001 + 0011 + 0010 + 0111 + 0101 + 0011 + 0001
= σ(1,2,3,5,7,8,9)
DISPLAY DECODER

 A common output device used to display


decimal numbers is the seven-segment display.
 The seven-segments are labeled with standard
letters from a to g.
 For instance, if the segment a, b, c, d and g light,
a decimal 3 appears.
DISPLAY DECODER

 The truth table for display decoder:


END OF
CHAPTER 7
CODE CONVERTER

You might also like