PLC Programming HandbooksPopular ArticlesNavigationUser login |
Using Ladder Logic for Gray Code ConversionIf 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.
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.
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:
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...
|
very nice and it is very
very nice and it is very easy to understand thank u
Excellent Instruction.
Now I understand Gray Code.
Very clear and detail teaching.
I do appreciate it.
Haven't used a plc for over
Haven't used a plc for over 10yrs this has been a really good refresher,thanks.