You are on page 1of 15

DB06

Code Conversion Binary to gray Gray to Binary


DB06

30
DB06
Introduction
DB06 is a compact, ready to use Code Conversion (binary to gray & gray to Binary)
experiment board. This experiment board has been designed to study code converters
used for translating from code to code. It can be used as stand alone unit with external
power supply or can be used with Scientech Digital Lab Scientech 2611 which has
built in power supply, pulse generator, pulser switches, 8 bits data switches, logic
probe, digital display, 8 bits LED display.

31
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 digital system. It is
sometimes necessary to use the output of one system as the input to another. 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 even though each uses a different binary code.
The binary number system is a system that uses only the digits 0 & 1 as codes. To
represent a group of 2n distinct element in a binary code requires a minimum of n bits.
This is because it is possible to arrange n bits in 2n distinct ways. Although the
minimum number of bits required to code 2n distinct quantities is n, there is no
maximum number of bits that may be used for binary code. For example, a group of
four distinct quantities can be represented by a two bit code, with each quantity
assigned one of the following bit combinations: 00, 01, 10, and 11. A group of eight
elements requires a three bit code, with each element assigned to one and only one of
the following 000, 001, 010, 011, 100, 101, 110, and 111. (Refer table 1).
Gray code (reflected code) is shown in Table 1. Number in the gray code changes by
only one bit as it proceeds from one number to the next. For example in going from
decimal 7 to 8, the gray code number changes from 0100 to 1100; these number differ
only in MSB. So it is with the entire gray code; every number differs by only one bit
from the preceding number. The logic diagram for binary code to gray code converter
and gray code to binary code converter is shown in fig. 1 and fig. 2.
Decimal Gray Code Binary
0 0000 0000
1 0001 0001
2 0011 0010
3 0010 0011
4 0110 0100
5 0111 0101
6 0101 0110
7 0100 0111
8 1100 1000
9 1101 1001

Table. 1
The logic equations for

Binary to gray code conversion

G0 = B0  B1
G1 = B1  B2
G2 = B2  B3
G3 = B3

Gray to binary code conversion

B0 = G3  G2  G1  G0
B1 = G3  G2  G1
B2 = G3  G2
B3 = G3
Experiment
Objective:
To study and verify the code conversion circuits. 3.
1. Binary to Gray Code D
2. Gray to Binary Code i
Apparatus required: g
1. Digital board DB06. i
2. DC Power Supply +5 V from external source or Scientech 2611 Digital lab. t
al Multimeter or Digital Lab Scientech 2611. Logic
diagram & Truth Table:
(Logic 1 = +5V & Logic 0= GND)

Fig.1

Decimal A B C D Decimal E F G H

0 0 0 0 0 0

1 0 0 0 1 1

2 0 0 1 0 2

3 0 0 1 1 3
4 0 1 0 0 4

5 0 1 0 1 5

6 0 1 1 0 6

7 0 1 1 1 7

8 1 0 0 0 8

9 1 0 0 1 9

10 1 0 1 0 10

11 1 0 1 1 11

12 1 1 0 0 12

13 1 1 0 1 13

14 1 1 1 0 14

15 1 1 1 1 15
Table.1

Fig.2
Decimal A B C D Decimal E F G H

0 0 0 0 0 0

1 0 0 0 1 1

2 0 0 1 1 2

3 0 0 1 0 3

4 0 1 1 0 4

5 0 1 1 1 5

6 0 1 0 1 6

7 0 1 0 0 7

8 1 1 0 0 8

9 1 1 0 1 9

10 1 1 1 1 10

11 1 1 1 0 11

12 1 0 1 0 12

13 1 0 1 1 13

14 1 0 0 1 14

15 1 0 0 0 15

Table. 2
DB06
Procedure:
1. Connect +5 V and ground to their indicated position on DB06 experiment board
from external DC power supply or from DC power block of Digital Lab Scientech
2611.
2. Connect inputs A, B, C, D as per truth table 2 to binary to gray code converter
as shown in fig.1.
3. Switch ON the power supply.
4. Observe output E, F, G, H on multimeter or on LED Display of Digital Lab
Scientech 2611.
5. Repeat above step for remaining inputs and prove truth table.
6. Repeat above steps for gray to binary code converter and prove truth table.
(Refer fig. 2 & table 3)

37
DB07
DB07
Code Conversion BCD to Excess-3

37
DB07
Introduction
DB07 is a compact, ready to use Code Conversion experiment board. This
experiment board has been designed to study BCD to Excess-3 code converter. It can
be used as stand alone unit with external power supply or can be used with Scientech
Digital Lab Scientech 2611 which has built in Power supply, Pulse generator, Pulser
switches, 8 bits Data Switches, logic probe, 8 bits LED display.

38
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 digital system. It is
sometimes necessary to use the output of one system as the input to another. A
conversion circuit must be inserted between the two systems if each uses different
code for the same information. Thus, a code converter is a circuit that makes the two
systems compatible even though each uses a different binary code.
BCD is an abbreviation for binary-coded decimal. Binary codes for decimal digits
require a minimum of four bits. The BCD code expresses each digit in a decimal
number by its nibble equivalent. Weights are assigned to binary bits according to their
positions. The weights in the BCD codes are 8, 4, 2, and 1.
For example, the bit assignment 0110 can be interpreted by the weights to represent
the decimal digit 6 because 0  8 + 1  4 + 1  2 + 0  l = 6. Table1 shows BCD
code.
The excess-3 code is an important 4-bit code used with BCD numbers. To convert any
decimal number in to its excess-3 form, add 3 to each decimal digit, and then convert
the sum to a BCD number. To convert decimal 5 to an excess-3 number, first add 3 to
decimal digit:
5
+3
8
Now, convert the sum to BCD form
8 = 1000
So, 1000 in the excess-3 code stands for decimal 5.
To convert BCD to Excess-3, add 0011 to BCD code. Refer figure1 and table 1
Equations for Logic Diagram shown in experiment section.
E0 = B0’ (’ represents complement)
E1 = B0.B1+ (B0+Bl) ’
E2 = B2’ (B0+B1) + B2 (B0+B1) ’
E3 = B3+B2 (B0+B1)

Decimal BCD Excess-3

0 0000 0011

1 0001 0100

2 0010 0101

3 0011 0110

4 0100 0111

5 0101 1000

6 0110 1001

7 0111 1010

8 1000 1011

9 1001 1100

Table 1
Experiment
Objective:
Studying and verifying BCD to Excess-3 code conversion circuit and prove its Truth
Table.
Equipments Needed:
1. Digital board DB07.
2. DC Power Supply +5 V from external source or Scientech 2611 Digital lab.
3. Digital Multimeter or Digital Lab Scientech 2611.
Logic diagram & Truth Table:
(Logic 1 = +5 V & Logic 0=GND)

BCD to Excess-3 Code


Figure 1
Decimal B3 B2 B1 B0 E3 E2 E1 E0
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
Table 2
B3, B2, B1, B0 are Binary codes (B0 is LSB)
E3, E2, E1, E0 are Excess-3 code (E0 is LSB)

Procedure:
1. Connect +5V and ground to their indicated position on DB07 experiment board
from external DC power supply or from DC power block of Digital Lab
Scientech 2611.
2. Connect inputs B0, B1, B2, E3 as per Truth Table 2 to BCD to Excess-3 code
converter as shown in figure 1.
3. Switch ‘On’ the power supply.
4. Observe output E0, E1, E2, E3 on multimeter or on LED display of Digital Lab
Scientech 2611.
5. Repeat above steps for remaining of inputs and prove Truth Table.

You might also like