# Here’s a Quick Way to Convert Grey Code into Binary for PLC

Grey Code
Grey Code is used because only one bit of data will change at a time. The following chart shows the conversion of Grey Code to Binary.

 Number Binary Code Grey Code Number Binary Code Grey Code 0 0000 0000 8 1000 1100 1 0001 0001 9 1001 1101 2 0010 0011 10 1010 1111 3 0011 0010 11 1011 1110 4 0100 0110 12 1100 1010 5 0101 0111 13 1101 1011 6 0110 0101 14 1110 1001 7 0111 0100 15 1111 1000

It is essential for absolute encoders because if the power is interrupted, the encoder will know where it is within the one bit.

Example:
Power is interrupted when the encoder is between 7 and 8. If we look at Binary Code, all of the bits would be affected, and we would not be sure what number we are looking at for the encoder. Therefore we have lost our position. In Grey Code, only one bit changes, so we can still tell if we were on 7 or 8 if the power was interrupted.

The following sample PLC program will convert 4-bit grey code into binary code.
This code was written in an Automation Direct PLC software called Do-more Designer.

Contact me for the above program. I will be happy to email it to you.
Thank you,
Garry

If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLCs are not challenging to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimals, Hexadecimal, ASCII, and Floating Points.

To get this free article, subscribe to my free email newsletter.

Use the information to inform other people how numbering systems work. Sign up now.