Ladder Logic Latch / Unlatch Instructions
In this example we need to start/stop the motor. When the start button is pushed we want to start the motor, and when the stop button is pushed we want to stop the motor. Mind you when you the push buttons is pushed the input will go on as long as the button is pushed otherwise it will go off.
Input / Output
Ladder Logic Solution A
The important part in this example is to keep the signal on even when the operator releases his finger from the push button. What we really need to do is to latch the input signal for both start and stop. This is not a usual way to start a motor. This is only to demonstrate the use of the Latch/Unlatch instructions.
By pressing the start push button the input I:0/1 will be on and hence bit B3:0/0 will be On too. Once the operator release the start button. The start button input signal will go Off but B3:0/0 will stay on because of the OTL (Latch) instruction that we have used. This bit will stay on as long as the Stop button is not pushed.
Once the stop button is pushed the rung will evaluate to true and hence the OTU (unlatch) instruction will kick in and release the bit B3:0/0.
When bit B3:0/0 is on or off; the motor will be energized or de-energized
Ladder Logic Solution B
This problem could also be solved with another technique. The rung below will result to the same solution as the previous method. How does this work?
Rung0: When we press on the start button the rung will evaluate to true hence the motor will be energize.
Once the start button is release it's input will go off but the motor will stay on since we have the motor as a by pass to the start button. Therefore the motor will keep running. Now, once we press the stop button. The rung will evaluate to false, and that is how we stop the motor.
This example is about a bi-directional motor (Forward/ Reverse). Each direction has its own button and only one button to stop the motor. We also need to stop the motor before we change its direction.
Input / Output
This resembles a lot to the previous example the only difference is REV_MOTOR since we had a condition that says we should stop before we change direction. What we did here is, put the stop button on both directions of the motor and then we check to see if the direction that we want to run is clear, we do that by checking if the opposite direction is not running.
When the stop button is not pushed and the motor is not running in reverse direction. If we push the forward button the motor forward output will be energized, and it will also be latched in forward.
When the stop button is not pushed and the motor is not running is forward direction. If we push the reverse button the motor reverse output will be energized, and it will also be latched in reverse.
This means that we cannot switch direction unless we stop the motor from running, that is only when we can change the direction of the motor. To stop the motor we have to press the stop button.