Jump to content

Gray code

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by PierreAbbat (talk | contribs) at 09:58, 27 April 2002 (start). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

A Gray code is a code assigning to each of a contiguous set of integers, or to each member of a circular list, a word of symbols such that each two adjacent code words differ by one symbol. The canonical Gray code is a binary code for the nonnegative integers as follows:

 0 00000000
 1 00000001
 2 00000011
 3 00000010
 4 00000110
 5 00000111
 6 00000101
 7 00000100
 8 00001100
 9 00001101
10 00001111
11 00001110
12 00001010
13 00001011

Gray codes are used in angle-measuring devices to avoid the possibility that, when several bits change in the binary representation of an angle, a misread could result from some of the bits changing.