Over the last couple of years, I've written quite a few articles and blogs about Gray codes (see article #201002340 for example). However, I've tended to focus on binary Gray codes, because "I R a Digital Logic Designer" of the old school.
However, the reason I'm waffling on here is that there are a variety of specialized types of Gray codes other than the binary-reflected Gray code (see the Wikipedia entry on Gray Codes for more details).
For example, we have the so-called "n-ary Gray code (this is also known as a "non-Boolean Gray code" because it uses non-Boolean values in its encodings). In the case of a 3-ary (ternary) Gray code, for example, we would use the values 0, 1, and 2.
Now, trying to wrap your brain around the way in which this works is enough to bring tears to your eyes, which is why I tend not to think about it a lot, until I received the following email from a reader:
Dear Max, I am a research student in Scotland studying to get Ph. D. in engineering. I need to learn how to convert decimal or binary into a Ternary Gray Code for use in an algorithm I'm working on for the optimization of digital circuits.
Please, if you have time, can you explain how to implement a program to convert binary and/or decimal and/or ternary into a Ternary Gray Code?
Well, "would that I could, but I can't," as they say, because this is something I haven't previously pondered. It does sound interesting – something to exercise the old gray cells (pun intended) – but I'm up to my ears in alligators fighting fires as usual, and I really don't have any free bandwidth at this moment in time...
But I would like to know the answer myself, so if anyone is aware of anything interesting, preferably something pertaining to the topic above (grin), please drop me a line and share the good tidings...
Questions? Comments? Feel free to email me – Clive "Max" Maxfield – at email@example.com). And, of course, if you haven't already done so, don't forget to Sign Up for our weekly Programmable Logic DesignLine Newsletter.