0% found this document useful (0 votes)
224 views2 pages

How To Convert Binary To Gray Code

The document discusses the conversion between binary and gray codes. It explains that the most significant bit of gray code is the same as the first bit of binary. To get subsequent bits of gray code, exclusive-or (XOR) is performed on adjacent bits of binary. An example is given where the gray code 01011 corresponds to the binary 01101. The process is then reversed to describe how to convert from gray to binary using similar steps.

Uploaded by

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

How To Convert Binary To Gray Code

The document discusses the conversion between binary and gray codes. It explains that the most significant bit of gray code is the same as the first bit of binary. To get subsequent bits of gray code, exclusive-or (XOR) is performed on adjacent bits of binary. An example is given where the gray code 01011 corresponds to the binary 01101. The process is then reversed to describe how to convert from gray to binary using similar steps.

Uploaded by

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

Binary to Gray code conversion

The Binary to Gray code converter is a logical circuit that is used to convert the
binary code into its equivalent Gray code. By putting the MSB of 1 below the
axis and the MSB of 1 above the axis and reflecting the (n-1) bit code about an
axis after 2n-1 rows, we can obtain the n-bit gray code.

How to Convert Binary to Gray Code


o In the Gray code, the MSB will always be the same as the 1'st bit of the
given binary number.
o In order to perform the 2nd bit of the gray code, we perform the
exclusive-or (XOR) of the 1'st and 2nd bit of the binary number. It means
that if both the bits are different, the result will be one else the result
will be 0.
o In order to get the 3rd bit of the gray code, we need to perform the
exclusive-or (XOR) of the 2nd and 3rd bit of the binary number. The
process remains the same for the 4th bit of the Gray code. Let's take an
example to understand these steps.

Example- The gray code of the binary number 01101 is 01011.

Ranvir Singh- 35
Gray to Binary Code Conversion
The Gray to Binary code converter is a logical circuit that is used to convert
the gray code into its equivalent binary code. There is the following circuit
used to convert the Gray code to binary number.

Just like Binary to Gray code conversion; it is also a very simple process.
There are the following steps used to convert the Gray code into binary.

o Just like binary to gray, in gray to binary, the 1st bit of the binary
number is similar to the MSB of the Gray code.
o The 2nd bit of the binary number is the same as the 1st bit of the
binary number when the 2nd bit of the Gray code is 0; otherwise, the
2nd bit is altered bit of the 1st bit of binary number. It means if the
1st bit of the binary is 1, then the 2nd bit is 0, and if it is 0, then the
2nd bit be 1.
o The 2nd step continues for all the bits of the binary number.

Example-So, the binary number of the Gray code 01011 is 01101.

Ranvir Singh- 35

You might also like