Ladder Logic 106: One Shots
A one shot, or “differential”, is used to develop a signal that is exactly one scan in duration. As shown in the diagram above, when a signal is applied to a contact (a Pushbutton in the diagram above), no matter how long the signal stays on, a pulse of one scan length is generated after the one shot.
Different PLC manufacturers use different names and symbols for one shots, but they pretty much all operate the same. A one shot can be generated from the rising or falling edge of the signal. One Shot Rising (OSR), Positive Differential (PD) and Differential Up (DIFU) are some of the names given to rising edge signals, while One Shot Falling (OSF), Negative Differential (N) and Differential Down (DIFD) are the equivalent falling edge terms. Do you know them by a different name? I’d love to hear some of them, these are the ones I am familiar with.
One shots placed in the middle of rungs as input instructions need a bit address, and it is important that every one shot has a different address. I have seen a program where someone gave all the one shots the same address, and surprisingly it worked most of the time. When it didn’t, the results were quite… unpredictable.
This is fairly easy to understand. If someone holds down the ON Pushbutton, the device will still be turned off. This is important in some motor or actuator safety circuits to ensure that a device is initialized to the de-energized state.
Another example I like to give is the diagram below:
This is called an Accumulator rung. It adds whatever is in “Word 6”, (a memory location) to the number one and puts the result back in itself. The problem with this rung is that it doesn’t count what you want it to count, which is activations of the count signal. I like to give this exercise to new programmers and ask them to enter it into the PLC and guess what the number will be after one press of a button (assuming Word 6 is at zero of course). Many of them will say “one”. I will say “176” and get a lot of puzzled looks. I have done this enough times that I know about how quickly to press the button to get that count.
It’s fun to see the light go on when they realize that its not the signal that’s being counted, but the number of scans that occur while the button is pressed!
This of course is what the rung should look like if you want to count the number of signals (or pushbutton presses). It is another good way to illustrate some of the uses of one shots.
By the way, this accumulator circuit leads into another topic I will cover at a later date. A few things to note about the accumulator: you can count by numbers other than one, such as ten. You can subtract as well as add. There are other features that make this a useful tool; the accumulator is one of the basic circuits I tell students should be in every programmer’s toolkit.