this page in english diese Seite auf deutsch Beispiel

Gray code

The Gray code is a single-step code (i.e. a unit-distance code). It's often used in analog/digital conversion devices. Adjacent code patterns of Gray code differ in just only one bit to avoid ambiguity, i.e. consecutive code elements have a hamming distance of one.

Errors while read off, for example by oblique scanners, slightly different threasure values inside the detectors, delay and race conditions in logical circuits only give minimal effects while using Gray code.
In 1878 French man Émile Baudot (1845-1903) first presented this "cyclic permuted" code. It's named after Frank Gray ["Pulse Code Communication", U.S. Patent no. 2,632,058, March 17, 1953 (origin: uspto.gov) ].

Variations of the Gray code pursue special properties:


Herein an enhanced Gray code is described, where two bits are read out of each code track. That allows to reduce the numbers of code tracks to a half. This code can replace the well known Gray code resulting in smaller and cheaper sensor devices.
  Title

Mechanical encoder for digital measuring of length and angles

"4" binary scanner for stripe 3 v   v  
"3" most significant stripe      
   1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16  1  2  3  4
"1" stripe of code                  
"2" binary scanner for stripe 1 ^   ^  

Figure 1

Abstract

Every stripe of code is scanned on the encoder plate at two points with a special displacement. Therefore only half of the stripes of code are necessary.

A special code is used, that changes only one bit from one entry to the next when scanned on the displaced points. The most significant stripe of code is as the Gray code. On the other stripes of code the bit stream "1001110001100011" is used once or repeating. Scanning that bit stream displaced by 4 steps gives the bit stream "1100011000111001".

The encoder is smaller and cheaper than an Gray code encoder and can replace it.


 

Example

Figure 1 shows a code plate whith 16 steps. Figure 2 shows a circular code plate for measuring of angels whith 64 steps. The scanning points and their displacement are marked. code plate

The most significant stripe of code "3" is as the well known Gray code. i.e. one half of the stripe is filled whith ones and the other half whith zeroes. For sixteen digital steps it's the bit stream "1111111100000000". This stripe of code ist scanned like the well known incremental code by two binary scanners having a fixed mechanical displacement of a quarter of the whole way.

The next stripe of code "1" (and all following stripes of code "5") carries the bit stream "1001110001100011". Also this stripe of code ist scanned by two binary scanners having a fixed mechanical displacement of a quarter of the whole way. Displaced scanning gives the bit stream "1100011000111001".

most significant stripe of code 1 1 1 1 1 1 1 1, 0 0 0 0 0 0 0 0,
-"- whith displacement 0 0 0 0, 1 1 1 1 1 1 1 1, 0 0 0 0
less significant stripe of code 1, 0 0, 1 1 1, 0 0 0, 1 1, 0 0 0, 1 1
-"- whit displacement 1 1, 0 0 0, 1 1, 0 0 0, 1 1 1, 0 0, 1
hexadecimal B 9 8 A E F D C 4 6 7 5 1 0 2 3

In this way any four bit binary number is definitive related to sixteen positions at the code plate. It's a unit-distance code, changing only one bit from one entry to the next, as easily can be seen in the Karnaugh map:

 |
 
 
_
 
  8
_____
 
  9
_____
 |
 |B
_|
 
  A
 ____
 
 
_
 
  C
 ____
 
  D
_____
 
  F
_____
 |
 |E
_|
 
 
_
 |
 |4
_|
 
  5
 ____
 
  7
_____
 
  6
_____
 
 
_
 
 
_
 
  0
_____
 |
 |1
_|
 
  3
 ____
 
  2
_____
 
 
_
 |

To increase the resolution by two bits one further (fine, less significant) stripe of code is added and it's scanned by two further binary scanners. The bit stream on all further stripes of code ist like that at the second stripe of code "1", but four times finer and repeating.

The less significant stripe of code gives a on-bit-change for three consecutive steps. At every fourth step there is a change in one of the existing (coarse, more significant) stripes of codes.

	existing coarse
	digital steps   |       |       |       |       |       |
	bits at new      1,0 0,1 1 1,0 0 0,1 1,0 0 0,1 1 1,0 0, usw.
	code stripe      1 1,0 0 0,1 1,0 0 0,1 1 1,0 0,1 1 1,0
	new attached      , , ,   , , ,   , , ,   , , ,   , , ,
	fine digital steps

For further details read the german original text.
Reference:
"Abtastvorrichtung zur digitalen Weg- oder Winkelmessung"
DDR-Wirtschaftspatent
Anmeldetag: 29.04.1988 "H 03 M / 315 194 8"
Patentschrift DD 271 603 A1 vom 06.09.1989
A. Hok.

It took seven more years until a single track gray code (STGC) was described by Alain P. Hiltgen, Kenneth G. Paterson and M. Brandestini (1996).

www.ahok.de
[valid HTML4.01 and CSS]