130 Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Chapter 3 Timer and Counter Instructions (TON, TOF, RTO, TONR, TOFR, RTOR, CTU, CTD, CTUD, RES)
Description: The TONR instruction accumulates time until the following occurs:
· TONR instruction is disabled
· ACC ≥ PRE
The time base is always 1 ms. For example, for a two-second timer, enter 2000 for
the PRE value.
Set the Reset input parameter to reset the instruction. If TimerEnable is set when
Reset is set, the TONR instruction begins timing again when Reset is cleared.
A timer runs by subtracting the time of its last scan from the time now:
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.
TimerEnable
Enable Bit (EN)
Timer Done Bit (DN)
Timer Accumulated Value (ACC)
Timer Timing Bit (TT)
Preset
0
16649
ON
Delay
Timer did not reach PRE value
Make sure to scan the timer at least every 69 minutes while it runs. Otherwise, the ACC
value won’t 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 the following:
· A subroutine
· A section of code that is between JMP and LBL instructions
· A sequential function chart (SFC)
· An event or periodic task
· A state routine of a phase