What is the Gray code?
We recommend reading the Binary Number System before you start reading this tutorial. The Gray code is a special type of binary code that is unweighted (the digits that make up the code does not have an assigned weight).
Its characteristic is that between a combination of digits and the next, whether upstream or downstream, there is only a difference of one digit. So it is also called Progressive Code. This progression also occurs between the last and the first combination. That is why it is also called Cyclic code. (see table)
Gray code, is used mainly in position systems, either angular or linear. Its main applications are in industry and robotics. In Robotic, coded discs are used to give the position information that an axis have. This information is given in GRAY code. Analyzing the table above, we see that:
– When a binary number passes from:
0111 to 1000 (7 to 8 in decimal) or 1111 to 0000 (16 to 0 in decimal). All digits have changed.
– For the same case but with the Gray code:
0100-1100 (7 to 8 in decimal) or 1000-0000 (16 to 0 in decimal). Only one digit has changed.
The characteristic of moving from one code to another, changing only one digit, ensures less chance of error.