DEBOUNCE (Functionblock) |
Top Previous Next |
DEBOUNCE is a function block that will debounce a signal on both the active and inactive state. This is especially useful on noisy digital input signals that are driven by switches, relays etc. that can generate switch noise when switched on or off.
Note: this function block uses 2 TON function blocks.
Input: in : BOOL (true/false) This is the signal that will be debounced.
db_time : DINT (0..2147483648) The number of milliseconds the signal must be active/inactive before the state is considered valid.
Output: out : BOOL (true/false) The "in" signal after debounce. It is also free from noises that are shorter than the time defined in "db_time".
Declaration: FUNCTION_BLOCK Debounce;
Example: INCLUDE rtcu.inc |