CODE CONVERTER
CODE CONVERTER
LAB REPORT
Materials Required:
1. Breadboard.
• LED’s: Four.
• SSD: Four
• Digital IC’s: 7400 - Quad 2 input NAND, 7486 - Quad 2 input XOR and
Connecting Wires.
1 Code Converters:
A code converter is a circuit that makes the two systems compatible even though
each uses a different binary code. Binary codes are divided into two groups
weighted and non-weighted. BCD (binary-coded decimal) is a weighted code and
each binary digit is assigned a weight (8-4-2-1). The BCD code differs from the
conventional binary number representation, in the BCD code, each decimal digit is
binary coded. BCD is useful in applications where output information has to be
displayed in decimal.
In the non-weighted codes there are no specific weights associated with the
digits, as was the case with weighted codes. A non-weighted codes are the
excess-3 code and gray code. It is generated by adding 3 to a decimal number and
then converting the result to a 4-bit binary number. Excess-3 code is a self-
complementing code and is useful in arithmetic operations.
Cyclic code uses four non-weighted binary digits to represent decimal numbers.
Cyclic code have the unique feature that the successive code words differ only in one
bit position. One type of cyclic code is the reflected code, also known as the Gray
code.
b. Identify the number of inputs and outputs then assign the different
variables for inputs and outputs.
c. Construct the truth table which indicates the relationship between inputs
and outputs.
e. Design the simplified output logic expressions for excess - 3 code using
only 2 input NAND gates (Fig. 2(a)).
f. Design the simplified output logic expressions for 4 bit gray code using
only 2 input XOR gates (Fig. 2(b)).
g. Build the logic circuits for the above expressions using suitable IC’s
(Fig. 1(a) and Fig. 1(b))..
h. Apply the various combination of inputs according to the truth table and
observe the condi- tion of Output.
i. In addition to the status of Output LED’s, display the 0 and 1 using seven
segment display (Fig. 3(a) and Fig. 3(b)).
i. 3 eb 33 e
Design an internal Design an internal
b e e
2 circuit for BCD to 2
2 circuit for binary to
E-3 using only 2 e 1 gray code using e
1 b 1 only
input NAND gates e e
D 2 input XOR gates
0 b0 0
1. (b)
Fig. 1: Code converters (a) BCD to Excess - 3 (a) Binary to Gray Code.
Note:
1. What is the advantages of Excess - 3 code compared to BCD code.
Decimal A B C D e3 e2 e1 e0
0 0 0 0 0 0 0 1 1
1 0 0 0 1 0 1 0 0
2 0 0 1 0 0 1 0 1
3 0 0 1 1 0 1 1 0
4 0 1 0 0 0 1 1 1
5 0 1 0 1 1 0 0 0
6 0 1 1 0 1 0 0 1
7 0 1 1 1 1 0 1 0
8 1 0 0 0 1 0 1 1
9 1 0 0 1 1 1 0 0
10 1 0 1 0 x x x x
11 1 0 1 1 x x x x
12 1 1 0 0 x x x x
13 1 1 0 1 x x x x
14 1 1 1 0 x x x x
15 1 1 1 1 x x x x
KMAP
KMAP
CIRCUIT DIAGRAM USING XOR GATE
5V B4 A4 B3 A3 5V B4 A4 B3 A3
Y4 Y3 Y4 Y3
14 13 12 1110 9 8 14 13 12 1110 9 8
7400
7486
1 2 3 45 67
1 2 3 4 5 6 7
Y2 Y2
A1 B1 Y1 Ground A1 B1 Y1 Ground
A2 B2 A2 B2
(a) (b)
Fig. 2: IC pin diagrams (a) 7400 - 2 input NAND gates (b) 7486 - 2 input XOR gates.
Advantages of Excess - 3 code compared to BCD code:
1. These codes are self-complementary.
2. These codes use biased representation.
3. The excess-3 code has no limitation, so that it considerably simplifies arithmetic
operations.
4. The codes 0000 and 1111 can cause a fault in the transmission line. The excess-3
code doesn't use these codes and gives an advantage for memory organization.
5. These codes are usually un weighted binary decimal codes.
A code is reflective when the code is self complementing. In other words, when the code
for 9 is the complement the code for 0, 8 for 1, 7 for 2, 6 for 3 and 5 for 4. 2421BCD,
5421BCD and Excess-3 code are reflective codes. 8421 BCD and Excess-3 are sequential
codes.
CONCLUSION
After completing this experiment here, I conclude that with the help of this experiment, I
have came to an better understanding of how to convert the BCD code to excess three
code using NAND gate only and binary code to gray code using Xor gate only,I understood
also that how to use them in the circuit firstly in this experiment, I have solved the k-map
And then derived the solution expression in from k map and then made the truth table
for the given expression and lastly, I have made circuit.