Saturday, 20 July 2013




Gray code


 Here I'm telling you a direct method to write Gray code.
Gray code is the reflection of decimal number. And reflection is always in reversed of original.
Gray code writing depends on 2ᴺ.

  For N=1 

Here we discus 0 and 1 number only.
Write 0 and 1 in vertical line in decimal.
Decimal             Gray code
   0              →              0
   1         →              1

It shows that gray code of 0 is 0 and gray code of 1 is 1.



  For N=2

Here we discus 0,1,2,3 numbers only. Follow these steps.

a.       Write 0,1,2 and 3 in vertical line in decimal.
Decimal
0
1
2
3

b.      For every power of N remember its previous power to write the exact gray code.
c.       Copy gray code of power N=1 in vertical line in front of step a.
Decimal            Gray code
0           →                0
1           →                1
2
3

d.      Copy the reverse of step a in step c in front of 2 and 3 decimal number.
Decimal            Gray code
0          →             0
1          →             1
2          →             1
3          →             0

e.      Now write 0 with original gray code of N=1 and write 1 with reversed gray code of N=1 on left side.

Decimal            Gray code
0         →                 0  0
1         →                 0  1
2         →                 1  1
3         →                 1  0

This is the decimal to gray code conversion.

Note:
For N=3,4,5,6,.......... so on
The same steps will be followed as mentioned above.
For N=2 the remembering power is N=1.
For N=3 the remembering power is N=2.
For N=4 the remembering power is N=3.
For N=5 the remembering power is N=4.
And so on...........







Reactions:

0 comments :

Post a Comment