How Do Absolute Encoders Work?

Codes

Angle positions of the shaft are represented by bright and dark spots on the code disk. There are different possibilities to code a position:

Binary Code

The two-state code generates a value from powers to the base of 2. For example the number 10 is illustrated as follows:

1 x 233 + 0 x 222 + 1 x 211 + 0 x 20
The corresponding Binary number is 1010.
The code is a multistep code, i.e. the change from one position to another can cause a shift of several bits.
Scanning this code on a code disc would generate a problem, as due to process tolerances changes in the different tracks would not occur simultaneously. As a consequence invalid position values could be given.
The table below makes this problem clear: the change from position 7 into position 8. If bit 23 altered state before bits 20, 21 or 23 then all bits would be dark resulting in an value of 15 being given. The solution is a one step code; for example gray-code.

Gray-Code

Gray code is a one step code, i.e. only one single bit changes from one position to the next. The transfer from one position can be slightly shifted by imprecise scanning, but it is not possible that this would cause incorrect position values to be given.
Another advantage of the Gray code is en easy reversibility. The counting direction can easily be changed by inverting the most significant bit. Therefore it is possible to change the count direction just by using the complement-entry.
The Gray code has to be converted into a binary code, because the single bits of the gray code don’t have a determined value. This is done by a code converter, that consists of a cascaded of XORs.
Transition from 255 to 256 – only 1 bit changes in Gray Code,
while 9 bits change in Binary Code

Natural Binary

Grey Code

255

011111111
010000000
256
100000000
11000000

Natural Binary

Grey Code

255

011111111

010000000

256

100000000

11000000

Gray-Excess-Code

The „ordinary“ single step gray code is valid for resolutions which can be described as a power to the base of 2. For other resolutions the range of gray code combinations is limited by concentric trimming. This range doesn’t begin at 0, but is shifted by a determined value.
For evaluation half of the difference between the original and the reduced resolution is subtracted from the calculated binary value.
Resolutions, for example 360° for angle determination, are often realized with this code (Gray code 9 bit cut at both sides by 76 steps equals 360 steps).