About Gray Code
What is Gray Code?
A Gray code is an encoding of numbers so that adjacent numbers have a single digit differing by 1. The term Gray code is often used to refer to a "reflected" code, or more specifically still, the binary reflected Gray code.
Gray codes were originally designed to prevent spurious output from electromechanical switches. The code was designed by Bell Labs researcher Frank Gray and patented in 1953.
Uses of Gray Code
Gray codes are used in angle-measuring devices in preference to straightforward binary encoding. This avoids the possibility that, when several bits change in the binary representation of an angle, a misread could result from some of the bits changing before others. This application benefits from the cyclic nature of Gray codes, because the first and last values of the sequence differ by only one bit.
The binary-reflected Gray code can also be used to serve as a solution guide for the Tower of Hanoi problem. A detailed method may be found here. It also forms a Hamiltonian cycle on a hypercube, where each bit is seen as one dimension.
Due to the Hamming distance properties of Gray codes, they are sometimes used in Genetic Algorithms. They are very useful in this field, since mutations in the code allow for mostly incremental changes, but occasionally a single bit-change can cause a big leap and lead to new properties.
Gray codes are also used in labelling the axes of Karnaugh maps.
When Gray codes are used in computers to address program memory, the computer uses less power because fewer address lines change as the program counter advances.
Sources: http://mathworld.wolfram.com/GrayCode.html
http://en.wikipedia.org/wiki/Gray_code
Conversion Table
Below is the BCD to Gray Code conversion table, drawn by me.
0 Comments:
Post a Comment
<< Home