Portada » Why do absolute encoders give information encoded inGray?

Why do absolute encoders give information encoded inGray?

by admin
140 views

The fact that only one bit changes at each position increment makes the code more reliable and facilitates the correction of possible reading errors.

It is explained in detail below.

Let’s go back 80 years:

When PLCs did not yet exist and automation was carried out with wired logic, sequencers, to go from one state to another, had to do so by simply changing a contact or else there would be no guarantee that the state was correct.

Let’s imagine that two contacts, Ca and Cb, would have had to be closed to go from state 4 to 5, but the response times of each relay differ slightly, so if Ca closes a few milliseconds before Cb or vice versa, probably it would have gone to an incorrect state, which could not be allowed. For this reason, in 1947 Frank Gray created this code, known as Gray code or reflected binary code.

Why is gray code more reliable?

This code has the peculiarity that its values only differ by one bit, as we can see in this table. In binary, to go from 3 to 4, b0 and b1 change to 0 and b3 changes to 1, so three bits have changed state. However, in the case of the gray code, only b3 has changed, which has gone from zero to one.The same happens in many other combinations, such as in the case of 7 to 8 that change 4 bits.On the other hand, this fact also facilitates the detection of possible reading errors since from one reading to the next no more than one bit can have changed. With a digital electronic circuit, the failure can be detected in real time and even corrected if it occurs only sporadically.

In the case of binary code, if due to a reading error we see the weight bit 512 as one, we would be adding 512
to the real value, which would mean a large increase. In the Gray code, the variation of some bits means much smaller errors; That is why it is also called minimum error code. The image on the left shows an optical
disk of a Gray-coded 12-bit absolute encoder.

How to convert from Binary to Gray:

Converting the binary code to Gray is very simple, I am going to express it in the form of a digital electronic circuit with XOR gates because I think that is what is best understood. And I’m going to put the example with 6 bits, enough for it to be seen.

It can also be done by adding the original binary with the same shifted to the right, or multiplied by two, the result will be the same.

How to convert from Gray to binary:

Converting the Gray code to binary is also very simple, I am going to express it in the form of a digital electronic circuit with XOR gates because I think that is what is best understood. And I’m going to put the example with 6 bits, enough for it to be seen.

Summary/Conclusions:

  1. The reason why absolute encoders are Gray coded dates back to the
    1950s.
  2. Currently there are absolute encoders coded in Gray and binary and with
    current communication systems they offer equal reliability.
  3. In the case of low resolution encoders (8 to 12 bits) that connect to digital
    inputs of a PLC, Gray code offers more reliability
  4. In many cases, hybrid systems are used, in which the absolute position
    value – encoded in Gray – is only used to make a preset of the initial
    position value and from that point sine / cosine signals are used in
    incremental mode to have high resolution.
Add

Related News