plz plz reply fast

beenthere

Joined Apr 20, 2004
15,819
Make a truth table that relates the gray code to binary. Devise some way to use the gray code to automatically select the proper binary. You can make a simple algorithm to actually modify the gray code into binary, or use the gray code as an offset pointer into a table containing the binaries.
 

thatoneguy

Joined Feb 19, 2009
6,359
I found these with google:

MATLAB for converting grey code:

dec2bin(bin2gray(0:3, 'pam', 4))
dec2bin(bin2gray(0:7, 'pam', 8))
dec2bin(bin2gray(0:15, 'pam', 16))
dec2bin(bin2gray(0:31, 'pam', 32))
dec2bin(bin2gray(0:63, 'pam', 64))

( for 2, 3, 4, 5, and 6 bits)
And this PDF: Page 3 (PDF page 10) of this PDF shows truth table. That document is for converting binary to grey code using XOR gates, the K-Map is shown, so the inverse should be straightforward.
 
Top