Gray code

Also found in: Dictionary, Wikipedia.

Gray code

[′grā ‚kōd]
A modified binary code in which sequential numbers are represented by expressions that differ only in one bit, to minimize errors. Also known as reflective binary code.

Gray code

A binary sequence with the property that only one bit changes between any two consecutive elements (the two codes have a Hamming distance of one).

The Gray code originated when digital logic circuits were built from vacuum tubes and electromechanical relays. Counters generated tremendous power demands and noise spikes when many bits changed at once. E.g. when incrementing a register containing 11111111, the back-EMF from the relays' collapsing magnetic fields required copious noise suppression. Using Gray code counters, any increment or decrement changed only one bit, regardless of the size of the number.

Gray code can also be used to convert the angular position of a disk to digital form. A radial line of sensors reads the code off the surface of the disk and if the disk is half-way between two positions each sensor might read its bit from both positions at once but since only one bit differs between the two, the value read is guaranteed to be one of the two valid values rather than some third (invalid) combination (a glitch).

One possible algorithm for generating a Gray code sequence is to toggle the lowest numbered bit that results in a new code each time. Here is a four bit Gray code sequence generated in this way:

0 0 0 0 0 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 0 0 1 1 0 0 0

The codes were patented in 1953 by Frank Gray, a Bell Labs researcher.

Gray code

A binary code used to represent digits generated from a mechanical sensor that may be prone to error. Used in telegraphy in the late 1800s, and also known as "reflected binary code," Gray code was patented by Bell Labs researcher Frank Gray in 1947.

Only Change One Bit
In Gray code, there is only one bit location different between numeric increments, which makes mechanical transitions from one digit to the next less error prone. The following chart shows normal binary representations from 1 to 10 and the corresponding Gray code.
Decimal  Binary   Gray Digit Code     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
References in periodicals archive ?
Direct interface to most gray code or binary SSI sensors
To create a Gray code for sequences of length 1 use one copy of an N-gon (a regular two-dimensional polygon with N sides, with a 2-gon being a line segment) with labels [0], [1], .
The three 3 by 3 squares in the upper right half of Figure 3 are generated by first stripping away the left-most digit of the triples given in the Gray code of the left-hand column, leaving ordered pairs.
This paper takes an altogether different approach and describes a visually satisfying geometrical technique to generate Gray codes.
An ST proprietary 4/12 coding scheme for servo Gray code paired with a matched Trellis detector can be used to allow better disk formatting compared to today's 1/4 Gray code rates; 1/4 Gray code rates are anyway automatically supported by the Bramante chip to overcome any servo formatting legacy issue.
The thiNcoder Rotor is highly versatile offering multiple output configurations such as an analog potentiometer, multi-bit encoder or dual-function push-and-turn switch and a variety of product designs, including encoders (quadrature, gray code, binary), switches and potentiometers.
It also contains two Sample-and-Holds, folding and interpolation quantizer, error correction circuitry, pipelined Gray code decoder and four low-voltage differential signal (LVDS) outputs.
Gray Code Sequence Engines which minimize on-board digital
After setting out the basic tools of the book, he covers preliminary results, subword and non-subword statistics, avoidance of patterns, multi-restrictions, asymptotics and random set partition, gray codes and loopless algorithms, and normal ordering.
A Maple program to generate Gray codes for sequences of length LL given the alphabet {0,1,2,3,.