PPRuNe Forums - View Single Post - I will give 10 points to anyone who can answer this one!!
Old 20th December 2002 | 15:24
  #4 (permalink)  
South California Tea
 
Joined: Nov 2002
Posts: 1
Likes: 0
From: Berks, UK
Arrow

pullock,

At the danger of boring you to death with maths:

For a Gray-coded binary string G[i] of length n, the equivalent decoded binary string B[i] where i = [n-1 .. 0] can be got from the following:


Firstly, assign MSB of G to MSB of B (MSB of both strings are always the same):

B[n-1] = G[n-1]


For the rest of the bits:

B[i] = B[i+1] XOR G[i]

...for i= [n-2 .. 0]


I can post 'C' source for a working encoder and decoder (up to n=32 or 64) if required.

Cheers,
SCT
South California Tea is offline