0% found this document useful (0 votes)
7 views3 pages

TONR

Uploaded by

SALIM BOUAZIZI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

TONR

Uploaded by

SALIM BOUAZIZI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

TONR: Time accumulator (S7-1200, S7-1500)

TONR: Time accumulator

Description
The instruction "Time accumulator" is used to accumulate time values within a period set
by the parameter PT. When the signal state at the IN input changes from "0" to "1" (positive
signal edge), the instruction is executed and time PT starts. While the time PT is running,
the time values are accumulated that are recorded when the IN input has signal state "1".
The accumulated time is written to the ET output and can be queried there. When the dura-
tion PT expires, the output Q has signal state "1". The Q parameter remains set to "1",
even when the signal state at the IN parameter changes from "1" to "0" (negative signal
edge).
The R input resets the ET and Q outputs regardless of the signal state of the start input.
Each call of the "Time accumulator" instruction must be assigned an IEC timer in which the
instruction data is stored.

For S7-1200 CPU


An IEC Timer is a structure of the data type IEC_TIMER or TONR_TIME that you can de-
clare as follows:
• Declaration of a data block of system data type IEC_TIMER (for example, "MyIEC_TIM-
ER")
• Declaration as a local tag of the type TONR_TIME or IEC_TIMER in the "Static" section
of a block (for example, #MyIEC_TIMER)

For S7-1500 CPU


An IEC timer is a structure of the data type IEC_TIMER, IEC_LTIMER, TONR_TIME or
TONR_LTIME that you can declare as follows:
• Declaration of a data block of system data type IEC_TIMER or IEC_LTIMER (for exam-
ple, "MyIEC_TIMER")
• Declaration as a local tag of the type TONR_TIME, TONR_LTIME, IEC_TIMER or
IEC_LTIMER in the "Static" section of a block (for example, #MyIEC_TIMER)
The instruction data is updated in the following cases:
• When the instruction is called, if the ET or Q outputs are interconnected. If the outputs
are not interconnected, the current time value at output ET is not updated.
• At an access to the Q or ET outputs.
The execution of the Time accumulator" instruction requires a preceding logic operation. It
can be placed within or at the end of the network.

Parameters
The following table shows the parameters of the "Time accumulator" instruction:

Parameters Declaration Data type Memory area Description

S7-1200 S7-1500 S7-1200 S7-1500

I, Q, M, I, Q, M, D,
IN Input BOOL BOOL D, L or L, P, or Start input
constant constant

-1-
TONR: Time accumulator (S7-1200, S7-1500)

I, Q, M, I, Q, M, D,
R Input BOOL BOOL D, L or L, P or Reset input
constant constant
Maximum dura-
tion of time re-
I, Q, M, I, Q, M, D, cording
TIME,
PT Input TIME D, L or L, P or
LTIME The value of the
constant constant
PT parameter
must be positive.
Output that is set
I, Q, M, I, Q, M, D,
Q Output BOOL BOOL when time PT
D, L L, P
expires.
TIME, I, Q, M, I, Q, M, D, Accumulated
ET Output TIME
LTIME D, L L, P time

Pulse timing diagram


The following figure shows the pulse timing diagram of the "Time accumulator" instruction:

Example
The following example shows how the instruction works:

-2-
TONR: Time accumulator (S7-1200, S7-1500)

The following table shows how the instruction works using specific operand values:

Parameters Operand Value

IN Tag_Start Signal transition "0" => "1"


PT Tag_PresetTime T#10s
Q Tag_Status FALSE; after 10 s => TRUE
Signal transition from "0" =>
"1"
The time T#10s expires.
After 5 s signal transition
from "1" => "0":
The time at the "Tag_Elap-
ET Tag_ElapsedTime sedTime" operand remains
at T#5s.
After approx. 2 s, renewed
signal transition from "0" =>
"1":
The time at the "Tag_Elap-
sedTime" operand continues
to run at T#5s.
When the signal state of the "Tag_Start" operand changes from "0" to "1", the time pro-
grammed for the PT parameter is started. The time continues to run as long as the
"Tag_Start" operand has the signal state "1". When the signal state of the "Tag_Start" oper-
and changes from "1" to "0", the time stops and the current time value at the Tag_Elapsed-
Time operand is recorded. When the signal state at the "Tag_Start" operand changes again
from "0" to "1", the time continues to run starting at the time value that was recorded at the
transition from "1" to "0". When the time value specified for the PT parameter is reached,
the "Tag_Status" operand is set to the signal state "1". The current time value is stored in
the "Tag_ElapsedTime" operand.
For more information and the program code to the above named example, refer to: Sam-
ple Library for Instructions

See also
Overview of the valid data types
Memory areas (S7-1500)
Basic information on LAD
Memory areas (S7-1200)

-3-

You might also like