Rik's Ramblings

Wednesday, July 28, 2010

Gray Coding

I can never remember how it goes, and neither can you. So here, I've worked it out again and I'll write it down here for all our benefits:


000 0
100 4
110 6
010 2
011 3
111 7
101 5
001 1

0000 0
1000 8
1100 C
0100 4
0110 6
1110 E
1010 A
0010 2
0011 3
1011 B
1111 F
0111 7
0101 5
1101 D
1001 9
0001 1


The great thing about a Gray Code is that, for each transition, only one of the bits changes. This makes it ideal for those situation where you could be sampling the data right when the transition occurs. In such a situation you could (due to alignment errors, propagation delay, aliasing, or other reasons) get a false reading if you were using normal binary representation.

0 Comments:

Post a Comment



<< Home