Debounce
Due to an increase in the use of solid-state sensors like proximity switches, you’re less likely to see this Ladder Logic Programming Pattern, but the Debounce pattern still comes in handy on many projects:
Debounce
The Debounce pattern is useful when you’re dealing with “dry contact” inputs that might be prone to “bouncing”. On circuit closure the contacts can bounce, which may cause the input to oscillate between the on and off states temporarily. The input can also oscillate when when the contacts open because of arcing. Electrical noise from nearby high current conductors can actually induce electrical pulses in your low voltage inputs that might fool your logic into thinking the input is in the opposite state for a very brief duration.
The Debounce pattern is a variant of the State Coil pattern. In this case we use a delay on timer as the Trigger of the coil. This timer “makes sure” that the input is really on before we change the state of our Memory coil. The coil then seals itself in. The delay off timer is used to make sure that the input is really off before we allow the seal in circuit of the coil to be broken.
The setpoint times for the timers can be modified to suit the situation. If the Debounce pattern is being used to reject electrical noise, then the timers can probably be shortened to a few milliseconds, but if the problem is mechanical contact bounce then 50 or 100 ms (or even longer) might be necessary.
The Debounce pattern has some disadvantages: first, it delays the response time of the machine when reacting to this input. We want most machines to run as fast as possible, and we want to avoid unnecessary delays. Second, it consumes timers, which is more of a concern on older PLCs which have limited resources. Third, it complicates the logic.
Some programmers have gone so far as to add a Debounce to every single input on the machine. Due to the disadvantages I just listed, I would consider blindly adding Debounce logic to be an anti-pattern. I suggest you only use this pattern when you know you need it, or where there’s a high likelihood of needing it based on past experience.
In most cases Debounce logic can be avoided with some simple alternatives. First, use solid state and/or good quality sensors and switches where possible, which are less likely to bounce. Second, route high current wires on the machine in such a way that they don’t run in parallel with the low current control wiring. Third, check to see if your input cards have a filter function that you can turn on or adjust. The filter can be used to filter out high frequency (short duration) pulses from spurious electrical noise.
The Debounce pattern is often combined with the Input Map pattern.
[source: http://www.contactandcoil.com/patterns-of-ladder-logic-programming/debounce/]