Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

LAB EXERCISE: 4

DESIGN AND IMPLEMENTATION OF CODE CONVERTER

AIM:
To design and implement 4-bit
(i) Binary to gray code converter
(ii) Gray to binary code converter

THEORY:
The availability of a large variety of codes for the same discrete elements of information
results in the use of different codes by different systems. A conversion circuit must be inserted
between the two systems if each uses different codes for the same information. Thus, a code
converter is a circuit that makes the two systems compatible despite using different binary codes.
The bit combination is assigned to binary code to gray code. Since each code uses four bits to
represent a decimal digit. There are four inputs and four outputs. Gray code is a non-weighted
code.
The input variables are designated as B3, B2, B1, and B0 and the output variables are designated
as C3, C2, C1, and Co. From the truth table, the combinational circuit is designed. The Boolean
functions are obtained from K-Map for each output variable.
A code converter is a circuit that makes the two systems compatible even though each uses a
different binary code. To convert from binary code to Excess-3 code, the input lines must supply
the bit combination of elements as specified by code and the output lines generate the
corresponding bit combination of code. Each of the four maps represents one of the four outputs
of the circuit as a function of the four input variables.
A two-level logic diagram may be obtained directly from the Boolean expressions derived from
the maps. There are various other possibilities for a logic diagram that implements this circuit.
Now the OR gate whose output is C+D has been used to implement partially each of the three
outputs.
LOGIC DIAGRAM:
BINARY TO GRAY CODE CONVERTOR

K-Map for G3:

G 3 = B3
K-Map for G2:

K-Map for G1:

K-Map for G0:


TRUTH TABLE:
| Binary input | Gray code output |

B3 B2 B1 B0 G3 G2 G1 G0

0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1
0 0 1 0 0 0 1 1
0 0 1 1 0 0 1 0
0 1 0 0 0 1 1 0
0 1 0 1 0 1 1 1
0 1 1 0 0 1 0 1
0 1 1 1 0 1 0 0
1 0 0 0 1 1 0 0
1 0 0 1 1 1 0 1
1 0 1 0 1 1 1 1
1 0 1 1 1 1 1 0
1 1 0 0 1 0 1 0
1 1 0 1 1 0 1 1
1 1 1 0 1 0 0 1
1 1 1 1 1 0 0 0
LOGIC DIAGRAM:
GRAY CODE TO BINARY CONVERTER

K-Map for B3:

B3 = G3

K-Map for B2:


K-Map for B1:

K-Map for B0:


TRUTH TABLE:

| Gray Code | Binary Code |

G3 G2 G1 G0 B3 B2 B1 B0

0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1
0 0 1 1 0 0 1 0
0 0 1 0 0 0 1 1
0 1 1 0 0 1 0 0
0 1 1 1 0 1 0 1
0 1 0 1 0 1 1 0
0 1 0 0 0 1 1 1
1 1 0 0 1 0 0 0
1 1 0 1 1 0 0 1
1 1 1 1 1 0 1 0
1 1 1 0 1 0 1 1
1 0 1 0 1 1 0 0
1 0 1 1 1 1 0 1
1 0 0 1 1 1 1 0
1 0 0 0 1 1 1 1

POST EXPERIMENT QUESTIONS


Q1 What is the grey code equivalent of decimal number 5?

Q2 Convert binary number (10011)2 to Grey Code

Q3 Convert (101100)Gray Code to Binary Code

You might also like