PDA

View Full Version : I will give 10 points to anyone who can answer this one!!


pullock
15th December 2002, 02:22
Hi All,

I am writing a program that reads gillham gray code for a data logger. For those who don't know, gray code is that sent by an altitude encoder to a transponder in light aircraft.

I have a list of Gillham codes, and that is OK, but what I need for writing a program is a mathmatical equasion that converts the gillham code to either binary, hex, or decimal.

I have searched the internet in every way that I can and I can't find the info that I need, so my question is can anybody help me find out how to get this equasion PPPLLLLEEEEAAASSSSEEEEEEE???????????


Regards,

Pullock.

redtail
15th December 2002, 04:05
4 bit gray code from 'Digital Fundamentals" 6th Edition by Floyd

Decimal --- Binary --- Gray Code

0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
10 1010 1111
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 1111 1000

Can't you re-write someone else's Ti-8X conversion program?

pullock
15th December 2002, 12:50
Thanks for the heads up so far guys, I did find the list of codes in an ATC600A manual, however it still doesn't provide me with any easy equasion for the conversion. Short of writing a program that refers to a look up table of all the codes, i'm still stumped.........

South California Tea
20th December 2002, 15:24
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

SeldomFixit
21st December 2002, 11:38
Yeah, what he said Guv:confused:

HOVIS
11th January 2003, 16:58
Baker Street and..... Mornington Crescent!


Shouldn't this be in Jet Blast??