# Binary to Gray code conversion

Design binary to gray code converter

#### jbharath478 Profile Answers by jbharath478

• Aug 30th, 2008

It is easy to convert the binary number to gray number. First, for example take a binary number i.e ,101101.

Step 1: 101101 first write the MSB as it is i.e, darken bit i.e, 1
Step 2: add MSB and bit next to the MSB i.e, 1+0=1
Step 3: again add 0 and 1 we get i.e, 0+1=1
Step 4: again add 1 and 1 we get 1+1=0
Step 5: in previous step carry is occurred so neglect that carry . note that don't add carry to next add numbers
step 6: add 0+1 0+1= 1

Answer: Gray Code is : 111011

#### bdean Profile Answers by bdean

• Jan 20th, 2009

Just like any other binary coded conversions. The number 9 in "8421" is simply "1001" and converted to Gray (2421) is simply "1111." This follows with all numbers.

#### harry

• Jul 20th, 2011

how come these 2 answers don't tally? if we were to use the first technique to convert binary 1001 it seems like we cant get 1111 doesn't it? or i mistaken the way?

#### monu s

• Aug 25th, 2011

It should go like for eg..for 1010 d conversion will be 1111..n for 1001 d conversion will be 1101

#### mansoor

• Nov 15th, 2011

2421 code is a weighted code and gray code is an unweighted code.. so, they must be 2 different things

#### satis

• Aug 7th, 2012

1111 then we have to convert it by following method.
first step=write 1

second step=add 2nd position of lsb to first pos, of lsb=1+1=10=0
third step=addsecnd &third of lsb position=1=1=0

#### praveen

• Nov 28th, 2012

Q: Where we use binary to Gray code and vice-versa...?

#### tanuja

• Dec 22nd, 2012

first write 1 then 1 EXOR 1 then 1 EXOR 1 THEN 1 EXOR 1

Send   Reset