7.3.4 TONR_TIME
Function
TONR_TIME is called a time accumulator, which can accumulate the state 1 signal of the input signal IN
LD graphics
- Time accumulator timing diagram:

Parameter description
| Interface variable | Declaration | Data type | Description |
|---|---|---|---|
| IN | Var_Input | BOOL | Start input bit |
| PT | Var_Input | TIME | Set time input |
| Q | Var_Output | BOOL | Output bit |
| ET | Var_Output | TIME | Elapsed time |
| R | Var_Output | BOOL | Reset |
Corresponding syntax
- When the IN value changes from FALSE to TRUE, the timer starts
- When the ET value is less than the PT value and the IN value is TRUE, ET continues to count. When the IN value is FALSE, ET immediately stops timing and keeps
- When the ET value is equal to the PT value, the Q value outputs TRUE, ET stops timing and remains until IN becomes FALSE, and ET returns to 0
- At any time, when R is TRUE, the Q output value is FALSE, and the ET value stops immediately and returns to 0. When R changes from TRUE to FALSE, if IN is TRUE at this time, the timer starts
Don’t forget the definition
Function block usage requires global declaration of an instance
Example
- LD example is shown in the following animation:

- ST example is shown in the following code:
TONR_TIME_1(
IN:=IN1,
R:=RESET,
PT:=T#2s,
Q=>OUT,
ET=>ET
);
IF OUT THEN
iVar:=iVar+1;
else
iVar:=0;
END_IF;