Jul 242019
 

What is Gray code?

We recommend reading the Binary Number System tutorial before you start reading this tutorial. The Gray code is named for Bell Labs researcher Frank Gray, who described it in 1947. This code is a special type of binary code that is unweighted (the digits that make up the code does not have an assigned weight).

The code main characteristic is that between one combination of digits (0, 1) and the next one, 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 the table)

Decimal to Binary and Binary to Gray conversion (Gray code Table)

Gray code - Decimal to Binary and Binary to Gray conversion

This 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.

In communication systems Gray Code is used to detect unexpected changes in data. If the bits in a number are summed, the sum of the next number should only change by one with the sum alternating even and odd.

Binary and Gray code comparision

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.

– 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.

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

 Leave a Reply

(required)

(required)