6.a. Design and Implementation of Binary To Gray Code Converters Using Logic Gates
6.a. Design and Implementation of Binary To Gray Code Converters Using Logic Gates
6.a. Design and Implementation of Binary To Gray Code Converters Using Logic Gates
APPARATUS REQUIRED
2) LED 4
3) Switch 4
4) DC Power Source 1
5) NI Analog Discovery 2
6) Wires As Required
THEORY
The logical circuit which converts binary code to equivalent gray code is known as binary to
gray code converter. The gray code is a non-weighted code. The successive gray code differs
in one bit position only that means it is a unit distance code. It is also referred as cyclic code.
It is not suitable for arithmetic operations. It is the most popular of the unit distance codes. It
is also a reflective code. An n-bit Gray code can be obtained by reflecting an n-1 bit code about
an axis after 2n-1 rows, and putting the MSB of 0 above the axis and the MSB of 1 below the
axis.
PROCEDURE
1. Open Multisim.
2. Select file → New → Blank and recent → select Blank and click create button on the
bottom right corner of the window opened.
3. Select the components by pressing ctrl+W.
4. Select Master database, select group as TTL, select Family as 74STD,Select 7486N
from component.
5. Multi-section component being placed, a dialog box appears as shown in the figure
below:
6. Click A, you will get one Xor gate. It will be labelled as U1A.
7. Again you will get Multi-section option in that you select B from label U1.
15. Run the simulation change the value of the switches to verify the truth table.
Truth Table
BINARY GRAY CODE
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
G3 = ∑(8,9,10,11,12,13,14,15) G2 = ∑(4,5,6,7,8,9,10,11)
PROCEDURE:
Follow the same procedure as for Binary to gray to complete the circuit diagram as below.
CIRCUIT DIAGRAM:
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 0 0 0 1 1
0 0 1 1 0 0 1 0
0 1 0 0 0 1 1 1
0 1 0 1 0 1 1 0
0 1 1 0 0 1 0 0
0 1 1 1 0 1 0 1
1 0 0 0 1 1 1 1
1 0 0 1 1 1 1 0
1 0 1 0 1 1 0 0
1 0 1 1 1 1 0 1
1 1 0 0 1 0 0 0
1 1 0 1 1 0 0 1
1 1 1 0 1 0 1 1
1 1 1 1 1 0 1 0
6.C. Hardware Implementation of Code Converters Using
NI Analog Discovery 2
Gives students access to a 100 MS/s oscilloscope, a logic analyzer, and six other instruments
in a pocket-sized lab device.
The Analog Discovery 2 transforms any PC into an electrical engineering workstation. This
USB-powered device enables students to build and test analog and digital circuits in any
environment with the functionality of traditional benchtop instruments. In addition to the 100
MS/s two-channel oscilloscope, the Analog Discovery 2 provides a two-channel waveform
generator, 16-channel logic analyzer, 16-channel digital pattern generator, spectrum analyzer,
network analyzer, voltmeter, and ±5 VDC adjustable power supplies.
AIM:
Hardware Implementation of the same with NI Analog Discovery 2.
APPARATUS REQUIRED
2) NI Analog Discovery 2
3) Wires As Required
PROCEDURE:
1. Build the Binary to Gray and Vice Versa Circuit in the breadboard.
2. Use the below pin diagram for circuit connection in breadboard.
3. Use the above pin connection from AD2.
4. Red wire belongs to power. Take a wire connect to red wire and wire it to pin 14.
5. Black wire belongs to ground. Take a wire connect to Black wire and wire it to pin 7.
6. Use Pin 0- Pin 3 of AD2 as Input.
7. Connect Pin 0- Pin 3 of AD2 to B0,B1,B2,B3.
8. Use Pin 4- Pin 7 of AD2 as Output.
9. Connect Pin 4- Pin 7 of AD2 to G0,G1,G2,G3.
10. Search the application in PC for Waveform 2015.
11. In the above window click the Supplies Instrument.
15. Configure Digital I/O signal into a switch by selecting 0, Switch, Push/Pull (1/0) as
seen in Figure below for DIO 0-DIO3
RESULT
Thus, design and implementation of Binary to gray code converters and Vice Versa
using logic gates using Multisim and NI Analog Discovery 2.