- Tech know how online

Gray code

The Gray code is named after the American physicist Frank Gray, who did research at Bell Labs. It is a simple, one-step binary code in which two consecutive dual code words may differ only in a single bit.

The Gray code thus has a constant Hamming distance of 1 between two consecutive binary words. Gray code codewords can be only two bits, making four codewords possible, but equally 3, 4, 5, or 6, making 64 codewords. A simple Gray code corresponds to a code in which the bit combinations are created by keeping the last digits, the Least Significant Bits( LSB), the same and changing only the first bit, the Most Significant Bit( MSB). Thus, a two- digit bit combination 00 becomes 10 and 01 becomes 11. For a three-digit bit combination, the last two bits remain the same and for a four-digit bit combination, the last three bits remain the same. Only the first bit is changed. Thus 0110 becomes 1110 in the Gray code.

Transmission errors can be recognized by the fact that a sequence other than the theoretically specified sequence of code words offset by 1 bit is read out at the end of the transmission path. For a 3-bit Gray code, the theoretical order of the code words would be 000, 001, 010, 011, 100, 101, 110, 111. With errors, the Gray code could look like this: 000, 001, 011, 010, 011, 110, 100, 101, 110, 111. The two binary values 011 and 110 would appear as errors.

Different one-step codes

Different one-step codes

The Gray code was originally developed for electromechanical sensors and switches that are prone to errors. Today, the code is used for error correction in digital transmission systems such as DVB-T and in cable television. In addition to the classic Gray code, there is also the Gray excess code. It has a bit pattern that is shifted by 3 positions compared to the Gray code. In addition, the first three and last three code words are omitted. Thus, the Gray excess code has the bit pattern 0010 for the decimal 0 and the code word 0110 for the decimal 1, and so on.

Furthermore, there are several one-step binary codes that are very similar to the Gray code. These include the Glixon code, O`Brien code, Tompkins code and the Petherick code.

Englisch: Gray code
Updated at: 10.07.2019
#Words: 347
Links: code, binary code (BC), constant, least significant bit (LSB), binary digit (Bit)
Translations: DE

All rights reserved DATACOM Buchverlag GmbH © 2022