Thursday, August 21, 2014

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.

NumberBinary CodeGrey CodeNumberBinary CodeGrey Code
000000000810001100
100010001910011101
2001000111010101111
3001100101110111110
4010001101211001010
5010101111311011011
6011001011411101001
7011101001511111000

It is important 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 are looking at Binary Code all of the bits would be effected and we would not be sure as to what number we are looking at for the encoder. Therefore we have lost position. In Grey Code only one bit changes so we will still be able to 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.


Do-more Designer Software
How to use video's for Do-more Designer Software

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

No comments:

Post a Comment