0% found this document useful (0 votes)
283 views

Using Ladder Logic For Gray Code Conversion PDF

This document provides instructions for converting Gray code to binary using ladder logic for PLCs that do not have a built-in conversion instruction. It explains that the conversion process involves using XOR gates to compare bits from the Gray code to generate the corresponding binary output. An example is given converting the 4-bit Gray code 1011 to the binary 1101. Finally, ladder logic is shown implementing the conversion using XOR rungs for an Allen-Bradley PLC.

Uploaded by

Vladimir Ageev
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
283 views

Using Ladder Logic For Gray Code Conversion PDF

This document provides instructions for converting Gray code to binary using ladder logic for PLCs that do not have a built-in conversion instruction. It explains that the conversion process involves using XOR gates to compare bits from the Gray code to generate the corresponding binary output. An example is given converting the 4-bit Gray code 1011 to the binary 1101. Finally, ladder logic is shown implementing the conversion using XOR rungs for an Allen-Bradley PLC.

Uploaded by

Vladimir Ageev
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Using Ladder Logic for Gray Code Conversion

If your PLC does not support Gray code to binary conversion then it can be quite a trick developing the ladder logic to do it. First, you might want to double check that this instruction is not buried deep down somewhere in your manual. Here's a couple of PLCs that all ready have a Gray code to binary converter.

Manufacturer Allen Bradley Mitsubishi Omron

PLCs MicroLogix 1200 and 1500 Series C FX Series CS Series

Instruction Code GCD GRAY GBIN GRY

Automation Direct DL05, DL06, DL240, DL250, DL350, DL440, and DL450

This list is by no means complete but if you still need to do it in ladder logic then read on. Fortunately, the conversion is somewhat easy to do. Let me try to explain it first. 1. Copy the most significant bit of the Gray code which becomes the most significant bit of the binary code. 2. Take the next bit down in the Gray code and the most significant bit of the binary and do a logical XOR and this becomes the next bit in the binary code. 3. Take the next bit down in the Gray code and the next bit down in the binary code and do a logical XOR and this becomes the next bit in the binary code. 4. Continue this process until you reach the end of the Gray code. I know, writing it out doesn't help me much either. Maybe a picture will do better. This is how the process looks with logical XOR gate symbols.

Maybe that doesn't help much either. The XOR symbol is a logical gate that has a truth table of: Input 1 Input 2 Output 0 0 1 1 0 1 0 1 0 1 1 0

Doing it by hand you'd follow the steps like this example with a 4-bit Gray code.

So the Gray code of 1011 here is converted to binary 1101. You can check your work with the online Gray code to Binary converter tool (make sure to change the input number basis to 2 for binary). Let's get to the reason you're here... the ladder logic. An XOR gate is implemented like this in ladder logic.

The final ladder logic, following our example above, would look like this...

This is, of course, a generic example and you'll have to adapt it to your specific PLC. In Allen Bradley RSLogix 500 it would like so...

You might also like