Timer On Delay with Reset (TONR)

This information applies to the
CompactLogix
5370,
ControlLogix
5570,
Compact GuardLogix
5370,
GuardLogix
5570,
Compact GuardLogix
5380,
CompactLogix
5380,
CompactLogix
5480,
ControlLogix
5580, and
GuardLogix
5580 controllers.
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.
Function Block
Structured Text
TONR(TONR_tag);
Operands
Structured Text
Operand
Type
Format
Description
TONR tag
FBD_TIMER
Structure
TONR structure
See Structured Text Syntax for more information on the syntax of expressions within structured text.
Function Block
Operand
Type
Format
Description
TONR tag
FBD_TIMER
Structure
TONR structure
FBD_TIMER Structure
Input Parameter
Data Type
Description
EnableIn
BOOL
If cleared, the instruction does not execute and outputs are not updated. If set, the instruction executes.
Default is set.
TimerEnable
BOOL
If set, this enables the timer to run and accumulate time.
Default is cleared.
PRE
DINT
Timer preset value. This is the value in 1 msec units that ACC must reach before timing is finished. If invalid, the instruction sets the appropriate bit in Status and the timer does not execute.
Valid = 0 to maximum positive integer
Reset
BOOL
Request to reset the timer. When set, the timer resets.
Default is cleared.
When the Reset input parameter is set, the instruction clears EN, TT and DN and sets ACC = 0.
Output Parameter
Data Type
Description
EnableOut
BOOL
The instruction produced a valid result.
ACC
BOOL
Accumulated time in milliseconds.
ENF
BOOL
Timer enabled output. Indicates the timer instruction is enabled.
TT
BOOL
Timer timing output. When set, a timing operation is in progress.
DN
BOOL
Timing done output. Indicates when accumulated time is greater than or equal to preset.
Status
DINT
Status of the function block.
InstructFault (Status.0)
BOOL
The instruction detected one of the following execution errors. This is not a minor or major controller error. Check the remaining status bits to determine what occurred.
PresetInv (Status.1)
BOOL
The preset value is invalid.
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.
IMPORTANT:
Be sure to scan the timer at least every 69 minutes while it runs. Otherwise, the ACC value will not be correct.
The last_time_scanned value has a range of up to 69 minutes. The timer’s calculation rolls over if you don’t scan the timer within 69 minutes. The ACC value won’t be correct if this happens.
While a timer runs, scan it within 69 minutes if you put it in a:
  • Subroutine
  • Section of code that is between JMP and LBL instructions
  • Sequential function chart (SFC)
  • Event or periodic task
  • State routine of a phase
Affects Math Status Flags
No
Major/Minor Faults
None specific to this instruction. See for operand-related faults.
Execution
Function Block
Condition/State
Action Taken
Prescan
EnableIn and EnableOut bits are cleared to false.
Tag.EnableIn is false
EnableIn and EnableOut bits are cleared to false.
Tag.EnableIn is true
EnableIn and EnableOut bits are set to true.
The main algorithm of the instruction is executed and outputs are updated.
Instruction first run
N/A
Instruction first scan
EN, TT and DN are cleared ACC value is set to 0.
Postscan
EnableIn and EnableOut bits are cleared to false.
Structured Text
Condition/State
Action Taken
Prescan
See Prescan in the Function Block table.
Normal execution
See Tag.EnableIn is true in the Function Block table.
Postscan
See Postscan in the Function Block table.
Example
Function Block
Structured Text
TONR_01.PRE := 500;
TONR_01.Reset := Reset;
TONR_01.TimerEnable := Input;
TONR(TONR_01);
timer_state := TONR_01.DN;
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.