0% found this document useful (0 votes)
27 views5 pages

Verify Binary To Gray and Gray To Binary Conversion Using NAND Gates Only

The document explains the conversion processes between binary and Gray code using NAND gates, emphasizing the importance of Gray code in reducing errors during transitions between binary numbers. It outlines the rules for both conversions, provides logical expressions, and describes the setup for a circuit that utilizes LEDs to display the input and output values. The document also includes steps for connecting the circuit and interacting with it to observe the conversions.

Uploaded by

kanokig823
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views5 pages

Verify Binary To Gray and Gray To Binary Conversion Using NAND Gates Only

The document explains the conversion processes between binary and Gray code using NAND gates, emphasizing the importance of Gray code in reducing errors during transitions between binary numbers. It outlines the rules for both conversions, provides logical expressions, and describes the setup for a circuit that utilizes LEDs to display the input and output values. The document also includes steps for connecting the circuit and interacting with it to observe the conversions.

Uploaded by

kanokig823
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Verify Binary to Gray and Gray to Binary

conversion using NAND gates only.


To analyse the truth table of binary to gray and gray to binary
converter using combination of NAND gates and to understand the
working of binary to gray and gray to binary converter with the help
of LEDs display.

Introduction

Binary Numbers is default way to store numbers, but in many


applications binary numbers are difficult to use and a variation of binary
numbers is needed. Gray code is an ordering of the binary numeral
system such that two successive values differ in only one bit (binary
digit). Gray codes are very useful in the normal sequence of binary
numbers generated by the hardware that may cause an error or
ambiguity during the transition from one number to the next. So, the
Gray code can eliminate this problem easily since only one bit changes
its value during any transition between two numbers.

Gray code has property that two successive numbers differ in only one
bit because of this property gray code does the cycling through various
states with minimal effort and used in K-maps, error correction,
communication etc.

In computer science many a times we need to convert binary code to


gray code and vice versa. This conversion can be done by applying
following rules :

1) Binary to Gray conversion :

1. The Most Significant Bit (MSB) of the gray code is always equal to
the MSB of the given binary code.
2. Other bits of the output gray code can be obtained by Ex-ORing
binary code bit at that index and previous index.
There are four inputs and four outputs. The input variable are
defined as B3, B2, B1, B0 and the output variables are defined as G3,
G2, G1, G0. From the truth table, combinational circuit is
designed.The logical expressions are defined as :

B 3 = G3

B 2 ⊕ B3 = G2

B 1 ⊕ B2 = G1

B0 ⊕ B1 = G0

Figure-1: Binary to Gray Code Converter Circuit


Figure-2: Binary to Gray Code Converter Truth Table

2) Gray to binary conversion :


1.The Most Significant Bit (MSB) of the binary code is always equal to
the MSB of the given binary number.
2.Other bits of the output binary code can be obtained by checking gray
code bit at that index. If current gray code bit is 0, then copy previous
binary code bit, else copy invert of previous binary code bit.

There are four inputs and four outputs. The input variable are defined as
G3, G2, G1, G0 and the output variables are defined as B 3, B2, B1, B0. From
the truth table, combinational circuit is designed.The logical expressions
are defined as :

G 0 ⊕ G 1 ⊕ G 2 ⊕ G 3 = B0

G 1 ⊕ G 2 ⊕ G 3 = B1

G 2 ⊕ G 3 = B2
G3 = B3
Figure-3: Gray to Binary Code Converter Circuit

Figure-4: Gray to Binary Code Converter Truth Table

Gray to Binary Conversion


Step-1) Connect battery to supply 5V to the circuit.
Step-2) Press Switches for different inputs.

The switch in ON state is and the switch in OFF state is


Step-3) The corresponding combination of input and output LEDs lit up
for different combination of inputs.
The input gray code LEDs are G 3,G2,G1 and G0 and the output binary
code LEDs B3,B2,B1 and B0 glow accordingly.
The input LED in OFF state is and in ON state is .

The output LED in OFF state is and in ON state is .


Step-4) Click "Add" to add the values to the Truth Table.

Step-5) Click "Print" to get the print out of the Truth Table.

Binary to Gray Code Conversion


Step-1) Connect battery to supply 5V to the circuit.
Step-2) Press Switches for different inputs.

The switch in ON state is and the switch in OFF state is


Step-3) The corresponding combination of input and output LEDs lit up
for different combination of inputs.
The input binary code LEDs are B3,B2,B1 and B0 and the output gray code
LEDs G3,G2,G1 and G0 glow accordingly.

The input LED in OFF state is and in ON state is .

The output LED in OFF state is and in ON state is .


Step-4) Click "Add" to add the values to the Truth Table.

Step-5) Click "Print" to get the print out of the Truth Table.

You might also like