TON (Functionblock) |
Top Previous Next |
The TON function block is an ON delay timer that enables the "q" output a specific number of milliseconds after the trig input is enabled.
When the trig input is set TRUE, the elapsed time counter (et) is reset to zero and then incremented until the preset timer value (pt) is reached, after which the "q" output is set TRUE. When the trig input is switched to FALSE, the "q" output is set FALSE. If the trig input is set to FALSE before the et counter reaches the pt value, the timer keeps running but the "q" output is not set TRUE when the et counter reaches the pt value.
This image shows the TON function block timing:
Input: trig : BOOL (true/false) On the leading edge of this input, the output "q" will go high and the timer will start. When this input goes low, the "q" output will also go low.
pt : DINT (0..2147483648) Specifies the delay in ms. from "trig" going high to "q" going high.
Output: et : DINT (0..2147483648) The current value of the timer.
q : BOOL (true/false) Output from the timer. See description for "trig".
Declaration: FUNCTION_BLOCK TON;
Example: INCLUDE rtcu.inc |