Debouncing

This function block is used to filter the contact bounce of (electro-) mechanical switches.

The input signal P will only be given to the output Q, if the input signal is stable for at least the number of program cycles given by nCycle. If input P changes, an internal counter starts to count the passing program cycles. If P changes again before nCycle is reached, the internal counter is reset and starts again. Only if the last state of P is stable, output Q will change to that state.

Signals

Name I/O Type(s) Function
P I BIT Input signal
nCycle I WORD Number of wait cycles
Q O BIT Output signal

Visualization

If output Q is set to HIGH, the function block will be highlighted.

Comment

Because of this kind of delay any switching operation only makes sense every nCycle program cycle. Faster switching will be interpreted as contact bounce and will be ignored by the function block.