Department of Aviation Engineering Technology Superior University
Department of Aviation Engineering Technology Superior University
Superior University
Digital Techniques
AT-2226
Experiment No.10
Implementation of Code Converters using Gates
Prepared for
By:
Name:
ID:
Section:
Semester:
Total Marks:
Obtained Marks:
Signature:
Date:
Digital Techniques Lab 10
Equipment:
1. Digital Logic Trainer
2. IC 7447, IC 7486, AND, OR, NOT gates
3. Connecting wires
4. Resistors 180 ohms
Theory:
The availability of large variety of codes for the same discrete elements of information results in the
use of different codes by different digital systems. Sometimes it becomes necessary to use output one
system as input to another system.
A conversion circuit must be inserted between the two systems, if each uses different code for the
same information. When a decimal number is decoded such that each digit of the number is
represented by a 4-bit binary number, it is called 8421 Binary Coded Decimal Code or more simply
a BCD code.
Here, ten out of sixteen possible combinations of the code are selected to represent decimal 0 through
9. Most commonly used BCD codes are given below:
63
Table 10.1: Truth Table of BCD to Gray Code and Excess-3
EXCESS-3
DECIMAL BCD GRAY CODE
CODE
9 1001 1 1 01 1100
The important characteristics of the Gray code is that only one digit changes as we count from top to
bottom; that is why it is termed as minimum change code. The Gray code is used for input and
output devices. Primary use is in numeric input encoding applications, where we expect
nonrandom input value change (i.e. value n changes either to n-1 or to n+1).
Another decimal code that has been used in some old computers is Excess-3 code. Its code
assignment is obtained from the corresponding value of BCD after the addition of 3. The code is
used in many arithmetic circuits because it is self- complementing (i.e. the 9’s complement value
of the decimal number can be obtained by complementing each bit of the code).
Task 1: BCD to Seven Segment Display Code Conversion
Most Digital equipment has some means for displaying information in a form that can be understood
readily by the user or operator. One of the simplest and most popular methods for displaying
numerical digits uses a 7-segment configuration. To form decimal characters 0 through 9 and
sometimes hex characters A through
A BCD to 7-Segment Driver (IC 7447) is used to take four bit BCD input and provide the outputs
that will pass current through the appropriate segment of the display to generate desired output/
number. Truth Table for Active High and Active Low cases are shown below:
S2 1 16 vCC
2 f15 f
S1
g 10 9 8 7 6
3 14 g
g fcomm a b
4 a13 a a
7447 f b
g
5 b 12 b e c
d
S0 6 c 11 c
e dcomm cDp
1 2 3 4 5
S3 7 d10 d
GND8 e9 e
The segments of Seven Segment display are made of LEDs. Depending on the arrangements of the
LEDs, the display could be Common Anode or Common Cathode type. We are using common anode
type of display, which would require that either pin 3 or pin 8 is connected to Vcc and the input is
active low.
Truth Table:
Decimal
BCD (Active High)
Display
So S1 S2 S3 a b c d e f g
Output
0 0 0 0 0 1 1 1 1 1 1 0 0
0 0 0 1 1 0 1 1 0 0 0 0 1
0 0 1 0 2 1 1 0 1 1 0 1 2
0 0 1 1 3 1 1 1 1 0 0 1 3
0 1 0 0 4 0 1 1 0 0 1 1 4
0 1 0 1 5 1 0 1 1 0 1 1 5
0 1 1 0 6 0 0 1 1 1 1 1 6
0 1 1 1 7 1 1 1 0 0 0 0 7
1 0 0 0 8 1 1 1 1 1 1 1 8
1 0 0 1 9 1 1 1 0 0 1 1 9
Truth Table:
Decimal
BCD (Active Low -IC 7447) Display
Output
S0 S1 S2 S3 a b c d e f g
0 0 0 0 0 0 0 0 0 0 0 1 0
0 0 0 1 1 1 0 0 1 1 1 1 1
0 0 1 0 2 0 0 1 0 0 1 0 2
0 0 1 1 3 0 0 0 0 1 1 0 3
0 1 0 0 4 1 0 0 1 1 0 0 4
0 1 0 1 5 0 1 0 0 1 0 0 5
0 1 1 0 6 1 1 0 0 0 0 0 6
0 1 1 1 7 0 0 0 1 1 1 1 7
1 0 0 0 8 0 0 0 0 0 0 0 8
1 0 0 1 9 0 0 0 1 1 0 0 9
Task 2: BCD to Gray Code Conversion
The bit combination for the BCD and Gray code are listed in the table below. Since each code uses
four bits to represent a decimal digit, there must be four input variables and four output variables.
Truth Table:
Input
Output Gray Code Observed Output
BCD
A B C D W x y z W x y z
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
Logic Circuit Diagram:
D
Z
C
Y
B
X
A W
The bit combination for the BCD and Excess-3 code are listed in the table below. Since each code
uses four bits to represent a decimal digit, there must be four input variables and four output
variables.
Truth Table:
0 0 0 0 0 0 1 1
0 0 0 1 0 1 0 0
0 0 1 0 0 1 0 1
0 0 1 1 0 1 1 0
0 1 0 0 0 1 1 1
0 1 0 1 1 0 0 0
0 1 1 0 1 0 0 1
0 1 1 1 1 0 1 0
1 0 0 0 1 0 1 1
1 0 0 1 1 1 0 0
Procedure:
1. Insert the IC 74xx on the trainer’s breadboard.
2. Use any two Logic Switches (S2 to S9) of the trainer for Input and any one of the
LEDs (L0 to L15) of the trainer for Output indication.
3. Connect +5V to pin 14 (Vcc) and Ground to pin 7 (GND) of the IC.
4. By setting various combinations of the two switches verify that the output of the
gate is in accordance with the Truth Table shown above.
5. Record your observation.
Conclusion: