How do you determine direction of inputs using ladder diagrams with a PLC? Meaning, how do you save the previous state?
Previous state of inputs. I need to determine direction that photobeams were activated.. forward or reverse. If they are activated in reverse, perform one action. If they are activated forwards, perform a different action. Inputs labeled 1 through 6. Normal direction is 1 through 6.
Here’s a simple implementation of a latch in ladder logic:
and here’s one where you can reset the output:
These form the fundamental building blocks for memory in ladder logic. I’m not sure but is this what you’re looking for?
Usually a language implementing ladder logic will have higher level elements that implement memory such as D and T flip-flops. Read the documentation of your ladder logic implementation to see if they’re available.
OK, from your comments it looks like what you want is:
This assumes the sensors are close together such that the transition is 10->11->01 such that you can’t detect the travel direction while the item is triggering both sensors. Writing this declaratively:
Which translates to:
Now you can use the reverse detected signal to do what you want. If your ladder language has latches you can do this cleaner: