Latch Instruction
Now that we understand how inputs and outputs are processed by the plc, let's look at a variation of our regular outputs. Regular output coils are of course an essential part of our programs but we must remember that they are only TRUE when ALL INSTRUCTIONS before them on the rung are also TRUE. What happens if they are not? Then of course, the output will become false.(turn off)
Think back to the lunch bell example we did a few chapters ago. What would've happened if we couldn't find a "push on/push off" switch? Then we would've had to keep pressing the button for as long as we wanted the bell to sound. (A momentary switch) The latching instructions let us use momentary switches and program the plc so that when we push one the output turns on and when we push another the output turns off.
Maybe now you're saying to yourself "What the heck is he talking about?". (It's also what I'm thinking!) So let's do a real world example. Picture the remote control for your TV. It has a button for ON and another for OFF. (mine does, anyway) When I push the ON button the TV turns on. When I push the OFF button the TV turns off. I don't have to keep pushing the ON button to keep the TV on. This would be the function of a latching instruction.
The latch instruction is often called a SET or OTL (output latch). The unlatch instruction is often called a RES (reset), OUT (output unlatch) or RST (reset). The diagram below shows how to use them in a program.
Think back to the lunch bell example we did a few chapters ago. What would've happened if we couldn't find a "push on/push off" switch? Then we would've had to keep pressing the button for as long as we wanted the bell to sound. (A momentary switch) The latching instructions let us use momentary switches and program the plc so that when we push one the output turns on and when we push another the output turns off.
Maybe now you're saying to yourself "What the heck is he talking about?". (It's also what I'm thinking!) So let's do a real world example. Picture the remote control for your TV. It has a button for ON and another for OFF. (mine does, anyway) When I push the ON button the TV turns on. When I push the OFF button the TV turns off. I don't have to keep pushing the ON button to keep the TV on. This would be the function of a latching instruction.
The latch instruction is often called a SET or OTL (output latch). The unlatch instruction is often called a RES (reset), OUT (output unlatch) or RST (reset). The diagram below shows how to use them in a program.
Comments
When using static gates as building blocks, the most fundamental latch is the simple SR latch (or simple SR flip-flop), where S and R stand for set and reset. It can be constructed from a pair of cross-coupled NOR (negative OR) logic gates. The stored bit is present on the output marked Q.
Normally, in storage mode, the S and R inputs are both low, and feedback maintains the Q and Q outputs in a constant state, with Q the complement of Q. If S (Set) is pulsed high while R is held low, then the Q output is forced high, and stays high when S returns low; similarly, if R (Reset) is pulsed high while S is held low, then the Q output is forced low, and stays low when R returns low.