Timer On Delay with Reset (TONR)
The TONR instruction is a non-retentive timer that accumulates time when TimerEnable
is set.
Available Languages
Ladder Diagram
This instruction is not available in ladder diagram.
Structured Text
TONR(TONR_tag);
Operands
Structured Text
Operand | Type | Format | Description |
TONR tag | TIMER | Structure | TONR structure |
See Structured Text syntax for more information on the syntax
of expressions within structured text.
TIMER Structure
Mnemonic | Data Type | Description |
|---|---|---|
.EN | BOOL | The enable bit contains rung-condition-in when the instruction
was last executed. |
.TT | BOOL | The timing bit when set indicates the timing operation is in
process. |
.DN | BOOL | The done bit when set indicates the timing operation is complete
(or paused). |
.PRE | DINT | The preset value specifies the value (1 millisecond units) which
the accumulated value must reach before the instruction
indicates it is done. |
.ACC | DINT | The accumulated value specifies the number of milliseconds that
have elapsed since the TON instruction was enabled. |
Description
When true, the TONR instruction accumulates time until the:
- TONR instruction is disabled
- ACC ≥ PRE
The time base is always 1 msec. For example, for a 2-second timer, enter 2000 for the
PRE value.

Set the Reset input parameter to reset the instruction. If TimerEnable is set when
Reset is true, the TONR instruction begins timing again when Reset is false.
How a Timer Runs
A timer runs by subtracting the time of its last scan from the current time:
ACC = ACC + (current_time - last_time_scanned)
After it updates the ACC, the timer sets last_time_scanned = current_time. This gets
the timer ready for the next scan.
Affects Math Status Flags
No
Major/Minor Faults
None specific to this instruction. See Common Attributes for operand-related
faults.
Execution
Structured Text
Condition/State | Action Taken |
Prescan | EnableIn and EnableOut bits are cleared to false. |
Normal execution | EnableIn and EnableOut bits are set to true. The main algorithm of the instruction is executed and outputs are
updated. |
Postscan | EnableIn and EnableOut bits are cleared to false. |
Example
Structured Text
TONR_01.PRE := 500;
TONR_01.Reset := Reset;
TONR_01.TimerEnable := Input;
TONR(TONR_01);
timer_state := TONR_01.DN;
Provide Feedback