You are on page 1of 33

Timer operations (S7-1200, S7-1500)

Timer operations
This chapter contains the following information:

IEC Timers (S7-1200, S7-1500)

SIMATIC Timers (S7-1500)

IEC Timers
This chapter contains the following information:

TP: Generate pulse (S7-1200, S7-1500)

TON: Generate on-delay (S7-1200, S7-1500)

TOF: Generate off-delay (S7-1200, S7-1500)

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

---( TP )---: Start pulse timer (S7-1200, S7-1500)

---( TON )---: Start on-delay timer (S7-1200, S7-1500)

---( TOF )---: Start off-delay timer (S7-1200, S7-1500)

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

---( RT )---: Reset timer (S7-1200, S7-1500)

---( PT )---: Load time duration (S7-1200, S7-1500)

TP: Generate pulse


Description
You can use the "Generate pulse" instruction to set the output Q for a programmed duration. The instruction
is started when the result of logic operation (RLO) at input IN changes from "0" to "1" (positive signal edge).
The programmed time PT begins when the instruction starts. Output Q is set for the duration PT, regardless
of the subsequent course of the input signal. Even if a new positive signal edge is detected, the signal state
at the output Q is not afected as long as the PT time duration is running.
You can scan the current timer value at the ET output. The timer value starts at T#0s and ends when the
value of duration
PT is reached. When the duration PT is reached and the signal state at input IN is "0", the ET output is reset.
Each call of the "Generate pulse" instruction must be assigned to an IEC timer in which the instruction data is
stored.
Note
If the timer is not called in the program because it is skipped, for example, the ET output returns a constant
value as
soon as the timer has expired.

For S7-1200 CPU


An IEC timer is a structure of the data type IEC_TIMER or TP_TIME that you can declare as follows:
Declaration of a data block of system data type IEC_TIMER (for example, "MyIEC_TIMER")
Declaration as a local tag of the type TP_TIME, TP_LTIME or IEC_TIMER in the "Static" section of a block (for
example,
#MyIEC_TIMER)

Timer operations (S7-1200, S7-1500)

For S7-1500 CPU


An IEC timer is a structure of the data type IEC_TIMER, IEC_LTIMER, TP_TIME or TP_LTIME that you can
declare as follows:
Declaration of a data block of system data type IEC_TIMER or IEC_LTIMER (for example, "MyIEC_TIMER")
Declaration as a local tag of the type TP_TIME, TP_LTIME, IEC_TIMER or IEC_LTIMER in the "Static" section of
a block
(for example, #MyIEC_TIMER)
When you insert the instruction in the program, the "Call options" dialog opens in which you can specify
whether the IEC timer is stored in its own data block (single instance) or as a local tag (multiple instance) in
the block interface. If you create a separate data block, you will find it in the project tree in the "Program
resources" folder under "Program blocks > System blocks". For additional information on this topic, refer to
"See also".
The instruction data is updated both when the instruction is called and also each time the outputs Q or ET
are accessed. The execution of the "Generate pulse" instruction requires a preceding logic operation. It can
be placed within or at the end
of the network.
Parameter
The following table shows the parameters of the "Generate pulse" instruction:
Parameter

Declaration

Data type
S7-1200

IN
PT

Input
Input

Memory area

Description

I, Q, M, D, L

Start input

I, Q, M, D, L or

Duration of the

constant

pulse.

S71500

BOOL

BOOL

TIME

TIME, LTIME

The value of
the PT
parameter
must be
positive.
Q

Output

BOOL

BOOL

I, Q, M, D, L

Pulse output

ET

Output

TIME

TIME, LTIME

I, Q, M, D, L

Current
timer value

For additional information on valid data types, refer to "See also".


Timing diagram
The following figure shows the timing diagram of the "Generate pulse" instruction:

Timer operations (S7-1200, S7-1500)

TON: Generate on-delay


Description
You can use the "Generate on-delay" instruction to delay setting of the Q output by the programmed
duration PT. The instruction is started when the result of logic operation (RLO) at input IN changes from "0"
to "1" (positive signal edge). The programmed time PT begins when the instruction starts. When the duration
PT expires, the output Q has the signal state "1". Output Q remains set as long as the start input is still "1".
When the signal state at the start input changes from "1" to "0", the Q output is reset. The timer function is
started again when a new positive signal edge is detected at the start input.
The current timer value can be queried at the ET output. The timer value starts at T#0s and ends when the
value of duration
PT is reached. The ET output is reset as soon as the signal state at the IN input changes to "0".
Each call of the "Generate on-delay" instruction must be assigned to an IEC timer in which the instruction
data is stored.
Note
If the timer is not called in the program because it is skipped, for example, the ET output returns a constant
value as
soon as the timer has expired.

For S7-1200 CPU


An IEC timer is a structure of the data type IEC_TIMER or TON_TIME that you can declare as follows:
Declaration of a data block of system data type IEC_TIMER (for example, "MyIEC_TIMER")
Declaration as a local tag of the type TON_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, TON_TIME or TON_LTIME that you can
declare as follows:
Declaration of a data block of system data type IEC_TIMER or IEC_LTIMER (for example, "MyIEC_TIMER")

Declaration as a local tag of the type TON_TIME, TON_LTIME, IEC_TIMER or IEC_LTIMER in the "Static"
section of a block (for example, #MyIEC_TIMER)

Timer operations (S7-1200, S7-1500)

When you insert the instruction in the program, the "Call options" dialog opens in which you can specify
whether the IEC
timer is stored in its own data block (single instance) or as a local tag (multiple instance) in the block
interface. If you create
a separate data block, you will find it in the project tree in the "Program resources" folder under "Program
blocks > System
blocks". For additional information on this topic, refer to "See also".
The instruction data is updated both when the instruction is called and also each time the outputs Q or ET
are accessed. The execution of the "Generate on-delay" instruction requires a preceding logic operation. It
can be placed within or at the
end of the network.
Parameter
The following table shows the parameters of the "Generate on-delay" instruction:
Parameter

Declaration

Data type
S7-1200

IN
PT

Input
Input

Memory area

Description

I, Q, M, D, L

Start input

I, Q, M, D, L or

Duration of the

constant

on-delay

S71500

BOOL

BOOL

TIME

TIME, LTIME

The value of
the PT
parameter
must be
positive.
Q

Output

BOOL

BOOL

I, Q, M, D, L

Output that is
set when the
PT
time expires.

ET

Output

TIME

TIME, LTIME

I, Q, M, D, L

Current
timer value

For additional information on valid data types, refer to "See also".


Timing diagram
The following figure shows the timing diagram of the "Generate on-delay" instruction:

Timer operations (S7-1200, S7-1500)

TOF: Generate off-delay


Description
You can use the "Generate off-delay" instruction to delay resetting of the Q output by the programmed
duration PT. The Q output is set when the result of logic operation (RLO) at input IN changes from "0" to
"1" (positive signal edge). When the signal state at input IN changes back to "0", the programmed time PT
starts. Output Q remains set as long as the duration PT is running. When duration PT expires, the Q output
is reset. If the signal state at input IN changes to "1" before the PT time duration expires, the timer is
reset. The signal state at the output Q continues to be "1".
The current timer value can be queried at the ET output. The timer value starts at T#0s and ends when the
value of duration PT is reached. When the time duration PT expires, the ET output remains set to the current
value until the IN input changes back to "1". If input IN switches to "1" before the duration PT has expired,
the ET output is reset to the value T#0s.
Each call of the "Generate off-delay" instruction must be assigned to an IEC timer in which the instruction
data is stored.
Note
If the timer is not called in the program because it is skipped, for example, the ET output returns a constant
value as
soon as the timer has expired.

For S7-1200 CPU


An IEC timer is a structure of the data type IEC_TIMER or TOF_TIME that you can declare as follows:
Declaration of a data block of system data type IEC_TIMER (for example, "MyIEC_TIMER")
Declaration as a local tag of the type TOF_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, TOF_TIME or TOF_LTIME that you can
declare as follows:

Timer operations (S7-1200, S7-1500)

Declaration of a data block of system data type IEC_TIMER or IEC_LTIMER (for example, "MyIEC_TIMER")

Declaration as a local tag of the type TOF_TIME, TOF_LTIME, IEC_TIMER or IEC_LTIMER in the "Static"
section of a block (for example, #MyIEC_TIMER)

When you insert the instruction in the program, the "Call options" dialog opens in which you can specify
whether the IEC timer is stored in its own data block (single instance) or as a local tag (multiple instance) in
the block interface. If you create a separate data block, you will find it in the project tree in the "Program
resources" folder under "Program blocks > System blocks". For additional information on this topic, refer to
"See also".
The instruction data is updated both when the instruction is called and also each time the outputs Q or ET
are accessed. The execution of the "Generate off-delay" instruction requires a preceding logic operation. It
can be placed within or at the
end of the network.
Parameter
The following table shows the parameters of the "Generate off-delay" instruction:
Parameter

Declaration

Data type
S7-1200

IN
PT

Input
Input

Memory area

Description

I, Q, M, D, L

Start input

I, Q, M, D, L or

Duration of the

constant

of delay

S71500

BOOL

BOOL

TIME

TIME, LTIME

The value of
the PT
parameter
must be
positive.
Q

Output

BOOL

BOOL

I, Q, M, D, L

Output that is
reset when the
timer PT
expires.

ET

Output

TIME

TIME, LTIME

I, Q, M, D, L

Current
timer value

For additional information on valid data types, refer to "See also".


Timing diagram
The following figure shows the timing diagram of the "Generate off-delay" instruction:

Timer operations (S7-1200, S7-1500)

TONR: Time accumulator


Description
The "Time accumulator" instruction is used to accumulate time values within a period set by the PT
parameter. When the signal state at input IN changes from "0" to "1" (positive signal edge), the instruction
executes and the duration PT starts. While the duration PT is running, the timer values are accumulated that
are recorded when the IN input has signal state "1". The accumulated time is written to output ET and can
be queried there. When the duration PT expires, the output Q has the 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 outputs ET and Q regardless of the signal state at the start input.
Each call of the "Time accumulator" instruction must be assigned to 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 declare as follows:
Declaration of a data block of system data type IEC_TIMER (for example, "MyIEC_TIMER")
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 example, "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)

When you insert the instruction in the program, the "Call options" dialog opens in which you can specify
whether the IEC timer is stored in its own data block (single instance) or as a local tag (multiple instance) in
the block interface. If you create a separate data block, you will find it in the project tree in the "Program
resources" folder under "Program blocks > System blocks". For additional information on this topic, refer to
"See also".

Timer operations (S7-1200, S7-1500)

The instruction data is updated both when the instruction is called and also each time the outputs Q or ET are
accessed.
The execution of the Time accumulator" instruction requires a preceding logic operation. It can be placed
within or at the end of the network.
Parameter
The following table shows the parameters of the "Time accumulator" instruction:
Parameter

Declaration

Data type
S7-1200

IN
R
PT

Input
Input

Input

BOOL
BOOL

TIME

Memory area

Description

I, Q, M, D, L

Start input

I, Q, M, D, L or

Reset input

S71500
BOOL
BOOL
TIME, LTIME

constant
I, Q, M, D, L
or constant

Maximum
duration of
time
recording
The value of
the PT
parameter
must be
positive.

Output

BOOL

BOOL

I, Q, M, D, L

Output that is
set when the
PT
time expires.

ET

Output

TIME

TIME, LTIME

I, Q, M, D, L

Accumulate
d time

For additional information on valid data types, refer to "See also".


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

Timer operations (S7-1200, S7-1500)

---( TP )---: Start pulse timer


Description
Use the "Start pulse timer" instruction to start an IEC timer with a specified duration as pulse. The IEC timer
is started when the result of logic operation (RLO) changes from "0" to "1" (positive signal edge). The IEC
timer runs for the specified duration regardless of any subsequent changes in the RLO. The run of the IEC
timer is also not afected by the detection of a new positive signal edge. As long as the IEC timer is running,
the querying of the timer status for "1" returns the signal state "1". When the IEC timer has expired, the
timer status returns the signal state "0".
Note
You can start and query the IEC timer at various execution levels, as each querying of the outputs Q or ET
updates the
IEC_TIMER structure.

For S7-1200 CPU


The instruction "Start pulse timer" stores its data in a structure of the data type IEC_TIMER or TP_TIME.
You can declare the structure as follows:
Declaration of a data block of system data type IEC_TIMER (for example, "MyIEC_TIMER")
Declaration as a local tag of the type TP_LTIME or IEC_TIMER in the "Static" section of a block (for example,
#MyIEC_TIMER)
For S7-1500 CPU
The instruction "Start pulse timer" stores its data in a structure of the data type IEC_TIMER, IEC_LTIMER,
TP_TIME or
TP_LTIME. You can declare the structure as follows:
Declaration of a data block of system data type IEC_TIMER or IEC_LTIMER (for example, "MyIEC_TIMER")

Timer operations (S7-1200, S7-1500)

Declaration as a local tag of the type TP_TIME, TP_LTIME, IEC_TIMER or IEC_LTIMER in the "Static" section
of a block
(for example, #MyIEC_TIMER)

The instruction data is updated both when the instruction is called and also each time the assigned timer
is accessed. The current timer status is stored in the Q structure component of the IEC timer. You can use
a normally open contact to
query timer status for "1" or a normally closed contact for "0". The query on Q or ET (for example,
"MyTimer".Q or
"MyTimer".ET) updates the IEC_TIMER
structure.
The execution of the "Start pulse timer" instruction assumes a preceding logic operation. It can be placed
only at the end of the network.
Paramet
er
The following table shows the parameters of the "Start pulse timer"
instruction:
Parameter

Declaration

<Time
duration>

Input

<IEC timer>

InOut

Data type
S7-1200

S7-1500

TIME

TIME, LTIME

IEC_TIMER,
TP_TIME

IEC_TIMER,
IEC_LTIMER,
TP_TIME,
TP_LTIME

Memory area

Description

I, Q, M, D, L or

Duration with

constant

which the IEC


timer runs.

D, L

IEC timer that


is started.

For additional information on valid data types, refer to


"See also".
Examp
le
The following example shows how the instruction
works:

The "Start pulse timer" instruction is executed when the signal state of the operand "Tag_Input" changes
from "0" to "1". The timer "DB1".MyIEC_TIMER is started for the time stored in the operand "TagTime".

As long as the timer "DB1". MyIEC_TIMER is running, the timer status ("DB1".MyIEC_TIMER.Q) has signal state
"1" and the operand "Tag_Output" is set. When the IEC timer has expired, the signal state of the time status
changes back to "0" and the "Tag_Output" operand is reset.

---( TON )---: Start on-delay timer


Description
Use the "Start on-delay timer" instruction to start an IEC timer with a specified duration as on-delay. The IEC
timer is started when the result of logic operation (RLO) changes from "0" to "1" (positive signal edge). The
IEC timer runs for the specified

Timer operations (S7-1200, S7-1500)

time. The output returns the signal state "1" if the RLO at the input of the instruction has the signal state "1".
If the RLO
changes to "0" before the time expires, the IEC timer is reset. In this case, querying the timer status for "1"
returns signal
state "0". The IEC timer restarts when the next positive signal edge is detected at the input of the instruction.
Note
You can start and query the IEC timer at various execution levels, as each querying of the outputs Q or ET
updates the
IEC_TIMER structure.

For S7-1200 CPU


The instruction "Start on-delay timer" stores its data in a structure of the data type IEC_TIMER or
TON_TIME. You can declare the structure as follows:
Declaration of a data block of system data type IEC_TIMER (for example, "MyIEC_TIMER")
Declaration as a local tag of the type TON_TIME or IEC_TIMER in the "Static" section of a block (for
example,
#MyIEC_TIMER)
For S7-1500 CPU
The "Start on-delay timer" instruction stores its data in a structure of the data type IEC_TIMER, IEC_LTIMER,
TON_TIME or
TON_LTIME. You can declare the structure as follows:
Declaration of a data block of system data type IEC_TIMER or IEC_LTIMER (for example, "MyIEC_TIMER")

Declaration as a local tag of the type TON_TIME, TON_LTIME, IEC_TIMER or IEC_LTIMER in the "Static"
section of a block (for example, #MyIEC_TIMER)

The instruction data is updated both when the instruction is called and also each time the assigned timer is
accessed.
The current timer status is stored in the ET structure component of the IEC timer. You can use a normally
open contact to query timer status for "1" or a normally closed contact for "0". The query on Q or ET (for
example, "MyTimer".Q or "MyTimer".ET) updates the IEC_TIMER structure.
The execution of the "Start on-delay timer" instruction assumes a preceding logic operation. It can be
placed only at the end of the network.
Parameter
The following table shows the parameters of the "Start on-delay timer" instruction:
Parameter

Declaration

<Time
duration>

Input

<IEC timer>

InOut

Data type
S7-1200

S7-1500

TIME

TIME, LTIME

IEC_TIMER,
TON_TIME

IEC_TIMER,
IEC_LTIMER,
TON_TIME,
TON_LTIME

For additional information on valid data types, refer to "See also".


Example
The following example shows how the instruction works:

Memory area

Description

I, Q, M, D, L or

Duration with

constant

which the IEC


timer runs.

D, L

IEC timer that


is started.

Timer operations (S7-1200, S7-1500)

The "Start on-delay timer" instruction is executed when the signal state of the operand "Tag_Input"
changes from "0" to "1". The "MyIEC_TIMER timer is started for the time stored in the "TagTime" operand.

If the timer "MyIEC_TIMER" has expired and the operand "Tag_Input" has the signal state "1", querying
the timer status ("MyIEC_TIMER).Q) returns signal state "1" and the "Tag_Output" operand is set. When
the signal state of the operand "Tag_Input" changes to "0", the querying of the timer status returns the
signal state "0" and the operand "Tag_Output" is reset.

---( TOF )---: Start off-delay timer


Description
Use the "Start off-delay timer" instruction to start an IEC timer with a specified duration as on-delay. The
query of the timer status for "1" returns the signal state "0" if the result of logic operation (RLO) at the input
of the instruction has the signal state "1". When the RLO changes from "1" to "0" (negative signal edge), the
IEC timer starts with the specified time. The timer status remains at signal state "1" as long as the IEC timer
is running. When the timer has run out and the RLO at the input of the instruction has the signal state "0",
the timer status is set to the signal state "0". If the RLO changes to "1" before the time expires, the IEC
timer is reset and the timer status remains at signal state "1".
Note
You can start and query the IEC timer at various execution levels, as each querying of the outputs Q or ET
updates the
IEC_TIMER structure.

For S7-1200 CPU


The instruction "Start off-delay timer" stores its data in a structure of the data type IEC_TIMER or
TOF_TIME. You can declare the structure as follows:
Declaration of a data block of system data type IEC_TIMER (for example, "MyIEC_TIMER")
Declaration as a local tag of the type TOF_TIME or IEC_TIMER in the "Static" section of a block (for
example,
#MyIEC_TIMER)
For S7-1500 CPU
The "Start off-delay timer" instruction stores its data in a structure of the data type IEC_TIMER, IEC_LTIMER,
TOF_TIME or
TOF_LTIME. You can declare the structure as follows:
Declaration of a data block of system data type IEC_TIMER or IEC_LTIMER (for example, "MyIEC_TIMER")

Declaration as a local tag of the type TOF_TIME, TOF_LTIME, IEC_TIMER or IEC_LTIMER in the "Static"
section of a block (for example, #MyIEC_TIMER)

The instruction data is updated both when the instruction is called and also each time the assigned timer is
accessed.
The current timer status is stored in the ET structure component of the IEC timer. You can use a normally
open contact to query timer status for "1" or a normally closed contact for "0". The query on Q or ET (for
example, "MyTimer".Q or "MyTimer".ET) updates the IEC_TIMER structure.
The execution of the "Start off-delay timer" instruction assumes a preceding logic operation. It can be placed
only at the end

Timer operations (S7-1200, S7-1500)

of the network.
Parameters
The following table shows the parameters of the "Start off-delay timer" instruction:
Parameter

Declaration

<Time
duration>

Input

<IEC timer>

InOut

Data type
S7-1200

S7-1500

TIME

TIME, LTIME

IEC_TIMER,
TOF_TIME

IEC_TIMER,
IEC_LTIMER,
TOF_TIME,
TOF_LTIME

Memory area

Description

I, Q, M, D, L or

Duration with

constant

which the IEC


timer runs.

D, L

IEC timer that


is started.

For additional information on valid data types, refer to "See also".


Example
The following example shows how the instruction works:

The "Start off-delay timer" instruction is executed when the signal state of the operand "Tag_Input"
changes from "1" to "0". The timer #MyIEC_TIMER is started for the time stored in the operand "TagTime".

As long as timer #MyIEC_TIMER is running, the query of the time status (#MyIEC_TIMER.Q) returns the signal
state "1" and operand "Tag_Output" is set. If the timer has expired and the operand "Tag_Input" has the
signal state "0", the query of the timer status returns the signal state "0". If the signal state of the operand
"Tag_Input" changes to "1" before timer
#MyIEC_TIMER expires, the timer is reset. When the signal state of the operand "Tag_Input" is "1", the
query of the timer status returns the signal state "1".

---( TONR )---: Time accumulator


Description
You can use the "Time accumulator" instruction to record how long the signal is at the input of instruction
"1". The instruction is started when the result of logic operation (RLO) changes from "0" to "1" (positive
signal edge). The time is recorded as
long at the RLO is "1". If the RLO changes to "0", the instruction is halted. If the RLO changes back to "1", the
time recording
is continued. The query of the timer status for "1" returns the signal state "1" if the recorded time exceeds
the value of the
specified duration and the RLO at the input of coil is "1".
The timer status and the currently expired timer can be reset to "0" using the "Reset timer" instruction.
Note
You can start and query the IEC timer at various execution levels, as each querying of the outputs Q or
ET updates the

Timer operations (S7-1200, S7-1500)

IEC_TIMER structure.

For S7-1200 CPU


The "Time accumulator" instruction stores its data in a structure of the data type IEC_TIMER or
TONR_TIME. You can declare the structure as follows:
Declaration of a data block of system data type IEC_TIMER (for example, "MyIEC_TIMER")
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
The "Time accumulator" instruction stores its data in a structure of the data type IEC_TIMER, IEC_LTIMER,
TONR_TIME or
TONR_LTIME. You can declare the structure as follows:
Declaration of a data block of system data type IEC_TIMER or IEC_LTIMER (for example, "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 both when the instruction is called and also each time the assigned timer is
accessed.
The current timer status is stored in the ET structure component of the IEC timer. You can use a normally
open contact to query timer status for "1" or a normally closed contact for "0". The query on Q or ET (for
example, "MyTimer".Q or "MyTimer".ET) updates the IEC_TIMER structure.
The execution of the Time accumulator" instruction requires a preceding logic operation. It can be placed
only at the end of the network.
Parameter
The following table shows the parameters of the "Time accumulator" instruction:
Parameter

Declaration

<Time
duration>

Input

<IEC timer>

InOut

Data type
S7-1200

S7-1500

TIME

TIME, LTIME

IEC_TIMER,
TONR_TIME

IEC_TIMER,
IEC_LTIMER,
TONR_TIME,
TONR_LTIME

Memory area

Description

I, Q, M, D, L or

Duration with

constant

which the IEC


timer runs.

D, L

IEC timer that


is started.

For additional information on valid data types, refer to "See also".


Example
The following example shows how the instruction works:

The "Time accumulator" instruction executes on a positive signal edge in the RLO. The time is recorded
as long as the operand "Tag_Input" has the signal state "1".

Timer operations (S7-1200, S7-1500)

If the recorded time exceeds the value of the operand "TagTime", then the query of the timer status
("MyIEC_TIMER".Q) will return the signal state "1" and the operand "Tag_Output" will be set.

---( RT )---: Reset timer


Description
You can use the "Reset timer" instruction to reset an IEC timer to "0". The instruction is only executed if
the result of logic operation (RLO) at the input of the coil is "1". If current is flowing to the coil (RLO is
"1"), the structure components of the
timer in the specified data block are reset to "0". If the RLO at the input of the instruction is "0", the timer
remains unchanged.
The instruction does not influence the RLO. The RLO at the input of the coil is sent directly to the
output of the coil. You assign the "Reset timer" instruction an IEC timer that has been declared in
the program.
The instruction data is updated only when the instruction is called and not each time the assigned IEC
timer is accessed. Querying the data is only identical from the call of the instruction to the next call of
the instruction.
Parameters
The following table shows the parameters of the "Reset timer" instruction":
Parameter

<IEC timer>

Declaration

Output

Data type
S7-1200

S7-1500

IEC_TIMER,

IEC_TIMER,

TP_TIME,
TON_TIME,
TOF_TIME,
TONR_TIME

IEC_LTIMER,
TP_TIME,
TP_LTIME,
TON_TIME,
TON_LTIME,
TOF_TIME,
TOF_LTIME,
TONR_TIME,
TONR_LTIME

Memory area

Description

D, L

IEC timer that


is
reset.

For additional information on valid data types, refer to "See also".


Example
The following example shows how the instruction works:

The "Generate on-delay" instruction executes when the signal state of the "Tag_Input_1" operand changes
from "0" to "1". The timer stored in the "TON_DB" instance data block starts running for the time duration
specified by operand "Tag_PT".

Timer operations (S7-1200, S7-1500)

If operands "Tag_Input_2" and "Tag_Input_3" have the signal state "1", the "Reset timer" instruction is
executed and the timer stored in the "TON_DB" data block.

---( PT )---: Load time duration


Description
You can use the "Load time duration" instruction to set the time for an IEC timer. The instruction is
executed in every cycle when the result of logic operation (RLO) at the input of the instruction has the
signal state "1". The instruction writes the specified time to the structure of the specified IEC timer.
Note
If the specified IEC timer is running while the instruction executes, the instruction overwrites the current
time of the
specified IEC timer. This can change the timer status of the IEC timer.
You assign an IEC timer declared in the program to the "Load time duration" instruction.
The instruction data is updated only when the instruction is called and each time the assigned IEC timer is
accessed. The query on Q or ET (for example, "MyTimer".Q or "MyTimer".ET) updates the IEC_TIMER
structure.
Parameter
The following table shows the parameters of the "Load time duration" instruction:
Parameter
Description

Declaration

Data type

S7-1200
<Time duration>
M, D, L or

Input

Memory area

S7-

1500
TIME

TIME, LTIME
constant

<IEC timer>

Output
IEC_TIMER,
TP_TIME,
TON_TIME,
TOF_TIME,
TONR_TIME

IEC_TIMER,
IEC_LTIMER,
TP_TIME,
TP_LTIME,
TON_TIME,
TON_LTIME,
TOF_TIME,
TOF_LTIME,
TONR_TIME,
TONR_LTIME

For additional information on valid data types, refer to "See also".


Example
The following example shows how the instruction works:

D, L

I, Q,

Duration with
which the IEC
timer runs.
IEC timer, the
duration of which
is set.

The "Generate on-delay" instruction executes when the signal state of the "Tag_Input_1" operand changes
from "0" to "1".
The IEC timer stored in the instance data block "TON_DB" is started with the time duration that is specified by
the operand
"Tag_PT".

The "Load time duration" instruction is executed when the operand "Tag_Input_2" has the signal state "1".
The instruction writes the time duration "Tag_PT_2" in the instance data block "TON_DB" and at the same
time overwrites the value of the operand "Tag_PT" within the data block. The signal state of the timer status
may therefore change at the next query or when "MyTimer".Q or "MyTimer".ET are accessed.

SIMATIC Timers
This chapter contains the following information:

S_PULSE: Assign pulse timer parameters and start (S7-1500)

S_PEXT: Assign extended pulse timer parameters and start (S7-1500)

S_ODT: Assign on-delay timer parameters and start (S7-1500)

S_ODTS: Assign retentive on-delay timer parameters and start (S7-1500)

S_OFFDT: Assign off-delay timer parameters and start (S7-1500)

---( SP ): Start pulse timer (S7-1500)

---( SE ): Start extended pulse timer (S7-1500)

---( SD ): Start on-delay timer (S7-1500)

---( SS ): Start retentive on-delay timer (S7-1500)

---( SF ): Start off-delay timer (S7-1500)

S_PULSE: Assign pulse timer parameters and start


Description
The "Assign pulse timer parameters and start" instruction starts a programmed timer when a change from
"0" to "1" (positive signal edge) is detected in the result of logic operation (RLO) at input S. The timer
expires with the programmed duration
(TV) as soon as the signal state at input S is "1". If the signal state at input S changes to "0" before the
programmed duration
expires, the timer is stopped. In this case, the signal state at output Q is "0".
The duration is made up internally of a timer value and a time base and is programmed at parameter TV.
When the instruction is started, the programmed timer value is counted down towards zero. The time
base indicates the time period with which the timer value is changed. The current timer value is output
BI-coded at output BI and BCD-coded at output BCD.
If the timer is running and the signal state at input R changes to "1" then the current timer value and the
time base are also set to zero. If the timer is not running, the signal state "1" at the R input has no efect.

The "Assign pulse timer parameters and start" instruction requires a preceding logic operation for edge
evaluation and can
be placed within or at the end of the network.
The instruction data is updated at every access. It can therefore happen that the query of the data at the
start of the cycle returns diferent values than at the end of the cycle.
Note
In each case, the instruction decrements a specific value by one unit in an interval that is defined by its time
basis until
the time value is equal to "0". The decrementation takes place asynchronous to the user program. The
resulting timer is
therefore always up to one time interval shorter than the time base.

Parameter
The following table shows the parameters of the instruction "Assign pulse timer parameters and start":
Parameter

Declaration

Data type

Memory area

Description

<Timer>

InOut/Input

TIMER

Timer of the
instruction
The number of
timers depends
on the CPU.

Input

BOOL

I, Q, M, D, L

Start input

TV

Input

S5TIME, WORD

I, Q, M, D, L
or constant

Preset timer
value

Input

BOOL

I, Q, M, T, C, D, L, P
or constant

Reset input

BI

Output

WORD

I, Q, M, D, L, P

BCD

Output

WORD

I, Q, M, D, L, P

Output

BOOL

I, Q, M, D, L

Current timer
value
(BI-coded)
Current timer
value
(BCD format)
Status of the
timer

For additional information on valid data types, refer to "See also".


Timing diagram
The following figure shows the timing diagram of the instruction "Assign pulse timer parameters and start":

Example
The following example shows how the instruction works:

The timer "Timer_1" is started when the signal state of the operand "TagIn_1" changes from "0" to "1". The
timer expires with the timer value of the operand "TagIn_Number" as long as the operand "TagIn_1" has the
signal state "1". If the signal state of the operand "TagIn_1" changes from "1" to "0" before the timer expires,
the timer "Timer_1" is stopped. The operand "TagOut" is reset to "0" in this case.
The operand "TagOut" has the signal state "1" as long as the timer is running and the operand "TagIn_1" has
the signal state
"1". When the timer expires or is reset, the operand "TagOut" is reset to "0".

S_PEXT: Assign extended pulse timer parameters and


start
Description

Timer operations (S7-1200, S7-1500)

Page 2020 of
33

The "Assign extended pulse timer parameters and start" instruction starts a programmed timer when a
change from "0" to
"1" (positive signal edge) is detected in the result of logic operation (RLO) at input S. The timer expires with
the programmed
duration (TV), even if the signal state at input S changes to "0". As long as the timer is running, the output Q
has the signal
state "1". When the timer expires, the output Q is reset to "0". If the signal state at input S changes from "0"
to "1" while the
timer is running, the timer is restarted with the duration programmed at input TV.
The duration is made up internally of a timer value and a time base and is programmed at parameter TV.
When the instruction is started, the programmed timer value is counted down towards zero. The time
base indicates the time period with which the timer value is changed. The current timer value is output
BI-coded at output BI and BCD-coded at output BCD.
If the timer is running and the signal state at input R changes to "1" then the current timer value and the
time base are also set to zero. If the timer is not running, the signal state "1" at the R input has no efect.
The "Assign extended pulse timer parameters and start" instruction requires a preceding logic operation for
edge evaluation and can be placed within or at the end of the network.
The instruction data is updated at every access. It can therefore happen that the query of the data at the
start of the cycle returns diferent values than at the end of the cycle.
Note
In each case, the instruction decrements a specific value by one unit in an interval that is defined by its time
basis until
the time value is equal to "0". The decrementation takes place asynchronous to the user program. The
resulting timer is
therefore always up to one time interval shorter than the time base.

Parameter
The following table shows the parameters of the instruction "Assign extended pulse timer parameters and
start":
Parameter

Declaration

Data type

Memory area

Description

<Timer>

InOut/Input

TIMER

Timer of the
instruction
The number of
timers depends
on the CPU.

Input

BOOL

I, Q, M, D, L

Start input

TV

Input

S5TIME, WORD

I, Q, M, D, L
or constant

Preset timer
value

Input

BOOL

I, Q, M, T, C, D, L, P
or constant

Reset input

BI

Output

WORD

I, Q, M, D, L, P

BCD

Output

WORD

I, Q, M, D, L, P

Output

BOOL

I, Q, M, D, L

Current timer
value
(BI-coded)
Current timer
value
(BCD format)
Status of the
timer

For additional information on valid data types, refer to "See also".


Timing diagram
The following figure shows the timing diagram of the "Assign extended pulse timer parameters and start"
instruction:

Timer operations (S7-1200, S7-1500)

Page 2121 of
33

Examp
le
The following example shows how the instruction
works:

The timer "Timer_1" is started when the signal state of the operand "TagIn_1" changes from "0" to "1". The
timer expires with the timer value of the operand "TagIn_Number" without being afected by a negative edge
at input S. If the signal state of the operand "TagIn_1" changes from "0" to "1" before the timer expires, the
timer is restarted.
The operand "TagOut" has the signal state "1" as long as the timer is running. When the timer expires
or is reset, the operand "TagOut" is reset to "0".

S_ODT: Assign on-delay timer parameters and start


Description
The "Assign on-delay timer parameters and start" instruction starts a programmed timer when a change from
"0" to
"1" (positive signal edge) is detected in the result of logic operation (RLO) at input S. The timer expires with
the programmed

Timer operations (S7-1200, S7-1500)

Page 2222 of
33

duration (TV) as soon as the signal state at input S is "1". If the timer has expired correctly and input S still
has signal state
"1" then output Q returns signal state "1". If the signal state at input S changes from "1" to "0" while the timer
is running, the
timer is stopped. In this case, output Q is reset to signal state "0".
The duration is made up internally of a timer value and a time base and is programmed at parameter TV.
When the instruction is started, the programmed timer value is counted down towards zero. The time
base indicates the time period with which the timer value is changed. The current timer value is output
BI-coded at output BI and BCD-coded at output BCD.
If the time is running and the signal state at input R changes from "0" to "1" then the current timer value
and the time base are also set to zero. In this case, the signal state at output Q is "0". The timer is reset if
the signal state is "1" at the R input even if the timer is not running and the RLO at input S is "1".
Specify the timer of the instruction in the placeholder above the box. The timer must be declared with the
data type TIMER. The "Assign on-delay timer parameters and start" instruction requires a preceding logic
operation for edge evaluation and
can be placed within or at the end of the network.
The instruction data is updated at every access. It can therefore happen that the query of the data at the
start of the cycle returns diferent values than at the end of the cycle.
Note
In each case, the instruction decrements a specific value by one unit in an interval that is defined by its time
basis until
the time value is equal to "0". The decrementation takes place asynchronous to the user program. The
resulting timer is
therefore always up to one time interval shorter than the time base.

Parameter
The following table shows the parameters of the "Assign on-delay timer parameters and start" instruction:
Parameter

Declaration

Data type

Memory area

Description

<Timer>

InOut/Input

TIMER

Timer of the
instruction
The number of
timers depends
on the CPU.

Input

BOOL

I, Q, M, D, L

Start input

TV

Input

S5TIME, WORD

I, Q, M, D, L
or constant

Preset timer
value

Input

BOOL

I, Q, M, T, C, D, L, P
or constant

Reset input

BI

Output

WORD

I, Q, M, D, L, P

BCD

Output

WORD

I, Q, M, D, L, P

Output

BOOL

I, Q, M, D, L

Current timer
value
(BI-coded)
Current timer
value
(BCD format)
Status of the
timer

For additional information on valid data types, refer to "See also".


Timing diagram
The following figure shows the timing diagram of the "Assign on-delay timer parameters and start"
instruction:

Timer operations (S7-1200, S7-1500)

Page 2323 of
33

Example
The following example shows how the instruction works:

The timer "Timer_1" is started when the signal state of the operand "TagIn_1" changes from "0" to "1". The
timer expires with the timer value of the operand "TagIn_Number". If the timer expires and the operand has
the signal state "1", the operand "TagOut" is set to "1". If the signal state of the operand "TagIn_1" changes
from "1" to "0" before the timer expires, the timer
is stopped. The operand "TagOut" has the signal state "0" in this case.

S_ODTS: Assign retentive on-delay timer parameters and


start
Descripti
on
The "Assign retentive on-delay timer parameters and start" instruction starts a programmed timer when a
change from "0" to "1" (positive signal edge) is detected in the result of logic operation (RLO) at input S. The
timer expires with the programmed duration (TV), even if the signal state at input S changes to "0". If the
timer has expired, the "Q" output returns signal state
"1" regardless of the signal state at input "S". If the signal state at input S changes from "0" to "1" while
the timer is running, the timer is restarted with the duration programmed at input (TV).
The duration is made up internally of a timer value and a time base and is programmed at
parameter TV. When the

Timer operations (S7-1200, S7-1500)

Page 2424 of
33

instruction is started, the programmed timer value is counted down towards zero. The time base indicates the
time period
with which the timer value is changed. The current timer value is output BI-coded at output BI and BCD-coded
at output
BCD.
Signal state "1" at input R resets the current timer value and time base to "0" regardless of the signal state
at start input S. In this case, the signal state at output Q is "0".
The "Assign retentive on-delay timer parameters and start" instruction requires a preceding logic
operation for edge evaluation and can be placed within or at the end of the network.
The instruction data is updated at every access. It can therefore happen that the query of the data at the
start of the cycle returns diferent values than at the end of the cycle.
Note
In each case, the instruction decrements a specific value by one unit in an interval that is defined by its time
basis until
the time value is equal to "0". The decrementation takes place asynchronous to the user program. The
resulting timer is
therefore always up to one time interval shorter than the time base.

Parameter
The following table shows the parameters of the "Assign retentive on-delay timer parameters and start"
instruction:
Parameter

Declaration

Data type

Memory area

Description

<Timer>

InOut/Input

TIMER

Timer of the
instruction
The number of
timers depends
on the CPU.

Input

BOOL

I, Q, M, D, L

Start input

TV

Input

S5TIME, WORD

I, Q, M, D, L
or constant

Preset timer
value

Input

BOOL

I, Q, M, T, C, D, L, P
or constant

Reset input

BI

Output

WORD

I, Q, M, D, L, P

BCD

Output

WORD

I, Q, M, D, L, P

Output

BOOL

I, Q, M, D, L

Current timer
value
(BI-coded)
Current timer
value
(BCD format)
Status of the
timer

For additional information on valid data types, refer to "See also".


Timing diagram
The following figure shows the timing diagram of the "Assign retentive on-delay timer parameters and start"
instruction:

Timer operations (S7-1200, S7-1500)

Page 2525 of
33

Example
The following example shows how the instruction works:

The timer "Timer_1" is started when the signal state of the operand "TagIn_1" changes from "0" to "1". The
timer expires with the timer value of the operand "TagIn_Number", even if the signal state of the operand
"TagIn_1" changes to "0". When the timer expires, the operand "TagOut" is set to "1". If the signal state of
the operand "TagIn_1" changes from "0" to "1" while
the timer is running, the timer is restarted.

S_OFFDT: Assign off-delay timer parameters and start


Description
The "Assign off-delay timer parameters and start" instruction starts a programmed timer when a change
from "1" to "0" (negative signal edge) is detected in the result of logic operation (RLO) at input S. The timer
expires with the programmed duration (TV). As long as the timer is running or input S returns signal state
"1", then output Q has signal state
"1". When the timer expires and the signal state at input S is "0", output Q is reset to the signal state "0". If
the signal state at
input S changes from "0" to "1" while the timer is running, the timer is stopped. The timer is only restarted
after a falling
signal edge is detected at input S.
The duration is made up internally of a timer value and a time base and is programmed at parameter TV.
When the instruction is started, the programmed timer value is counted down towards zero. The time
base indicates the time period with which the timer value is changed. The current timer value is output
BI-coded at output BI and BCD-coded at output

Timer operations (S7-1200, S7-1500)

Page 2626 of
33

BCD.
Signal state "1" at input R resets the current timer value and time base to "0". In this case, the signal state
at output Q is "0". The "Assign off-delay timer parameters and start" instruction requires a preceding logic
operation for edge evaluation and
can be placed within or at the end of the network.
The instruction data is updated at every access. It can therefore happen that the query of the data at the
start of the cycle returns diferent values than at the end of the cycle.
Note
In each case, the instruction decrements a specific value by one unit in an interval that is defined by its time
basis until
the time value is equal to "0". The decrementation takes place asynchronous to the user program. The
resulting timer is
therefore always up to one time interval shorter than the time base.

Parameter
The following table shows the parameters of the "Assign off-delay timer parameters and start" instruction:
Parameter

Declaration

Data type

Memory area

Description

<Timer>

InOut/Input

TIMER

Timer of the
instruction
The number of
timers depends
on the CPU.

Input

BOOL

I, Q, M, D, L

Start input

TV

Input

S5TIME, WORD

I, Q, M, D, L
or constant

Preset timer
value

Input

BOOL

I, Q, M, T, C, D, L, P
or constant

Reset input

BI

Output

WORD

I, Q, M, D, L, P

BCD

Output

WORD

I, Q, M, D, L, P

Output

BOOL

I, Q, M, D, L

Current timer
value
(BI-coded)
Current timer
value
(BCD format)
Status of the
timer

For additional information on valid data types, refer to "See also".


Timing diagram
The following figure shows the timing diagram of the "Assign off-delay timer parameters and start"
instruction:

Timer operations (S7-1200, S7-1500)

Page 2727 of
33

Example
The following example shows how the instruction works:

The timer "Timer_1" is started when the signal state of the operand "TagIn_1" changes from "1" to "0". The
timer expires with the timer value of the operand "TagIn_Number". The operand "TagOut" is set to "1" when
the timer is running and when the operand "TagIn_1" has the signal state "0". If the signal state of the
operand "TagIn_1" changes from "0" to "1" while the
timer is running, the timer is reset.

---( SP ): Start pulse timer


Description
The "Start pulse timer" instruction starts a programmed timer when a change from "0" to "1" (positive
signal edge) is detected in the result of logic operation (RLO). The time runs with the specified duration as
long as the RLO has the signal state "1". As long as the timer is running, the querying of the timer status for
"1" returns the signal state "1". If there is a change from "1" to "0" in the RLO before the timer value has
elapsed, the timer stops. In this case, the querying of the timer status for "1" returns the signal state "0".
The duration is made up internally of a timer value and a time base. When the instruction is started, the
programmed timer value is counted down towards zero. The time base indicates the time period with
which the timer value is changed.
The "Start pulse timer" instruction requires a preceding logic operation for edge evaluation and can only
be placed at the right side of the network.

Timer operations (S7-1200, S7-1500)

Page 2828 of
33

Note
In each case, the instruction decrements a specific value by one unit in an interval that is defined by its time
basis until
the time value is equal to "0". The decrementation takes place asynchronous to the user program. The
resulting timer is
therefore always up to one time interval shorter than the time base.

Parameter
The following table shows the parameters of the "Start pulse timer" instruction:
Parameter

Declaration

Data type

Memory area

Description

<Time duration>

Input

S5TIME, WORD

I, Q, M, D, L or

Duration with
which
the timer
expires.
Timer which
is started.

constant
<Timer>

InOut/Input

TIMER

The number of
timers depends
on the CPU.
For additional information on valid data types, refer to "See also".
Example
The following example shows how the instruction works:

The timer "Timer_1" is started when the signal state of the operand "TagIn_1" changes from "0" to "1". The
timer expires with the timer value of the operand "TagIn_Number" as long as the signal state of the operand
"TagIn_1" is "1". If the signal state of the operand "TagIn_1" changes from "1" to "0" before the timer expires,
the timer is stopped. As long as the timer is running, the operand "TagOut" has the signal state "1". A signal
state change of the operand "TagIn_1" from "0" to "1" resets the timer, which stops the timer and sets the
current timer value to "0".

---( SE ): Start extended pulse timer


Description
The "Start extended pulse timer" instruction starts a programmed timer when a change from "0" to "1"
(positive signal edge) is detected in the result of logic operation (RLO). The timer expires with the specified
duration, even if the RLO changes to the signal state "0". As long as the timer is running, the querying of the
timer status for "1" returns the signal state "1". If the RLO changes from "0" to "1" while the timer is
running, the timer is restarted with the programmed duration. The querying of the timer status for "1"
returns the signal state "0" when the timer expires.

Timer operations (S7-1200, S7-1500)

Page 2929 of
33

The duration is made up internally of a timer value and a time base. When the instruction is started, the
programmed timer
value is counted down towards zero. The time base indicates the time period with which the timer value is
changed.
The "Start extended pulse timer" instruction requires a preceding logic operation for edge evaluation and
can only be placed at the right side of the network.
Note
In each case, the instruction decrements a specific value by one unit in an interval that is defined by its time
basis until
the time value is equal to "0". The decrementation takes place asynchronous to the user program. The
resulting timer is
therefore always up to one time interval shorter than the time base.

Parameter
The following table shows the parameters of the "Start extended pulse timer" instruction:
Parameter

Declaration

Data type

Memory area

Description

<Time duration>

Input

S5TIME, WORD

I, Q, M, D, L or

Duration with
which
the timer
expires.
Timer which
is started.

constant
<Timer>

InOut/Input

TIMER

The number of
timers depends
on the CPU.
For additional information on valid data types, refer to "See also".
Example
The following example shows how the instruction works:

The timer "Timer_1" is started when the signal state of the operand "TagIn_1" changes from "0" to "1". The
timer expires with the timer value of the operand "TagIn_Number" without being afected by a negative edge
in the RLO. As long as the timer is running, the operand "TagOut" has the signal state "1". If the signal state
of the operand "TagIn_1" changes from "0" to "1" before the timer expires, the timer is restarted.

---( SD ): Start on-delay timer


Description
The "Start on-delay timer" instruction starts a programmed timer when a change from "0" to "1" (positive
signal edge) is detected in the result of logic operation (RLO). The timer runs for the specified duration as
long as the RLO is "1". If the timer

Timer operations (S7-1200, S7-1500)

Page 3030 of
33

has expired and the RLO still has the signal state "1", the query of the timer status for "1" returns the signal
state "1". If the
RLO changes from "1" to "0" while the timer is running, the timer is stopped. In this case, the querying of the
timer status for
"1" returns the signal state "0".
The duration is made up internally of a timer value and a time base. When the instruction is started, the
programmed timer value is counted down towards zero. The time base indicates the time period with
which the timer value is changed.
The "Start on-delay timer" instruction requires a preceding logic operation for edge evaluation and can only
be placed at the right side of the network.
Note
In each case, the instruction decrements a specific value by one unit in an interval that is defined by its time
basis until
the time value is equal to "0". The decrementation takes place asynchronous to the user program. The
resulting timer is
therefore always up to one time interval shorter than the time base.

Parameter
The following table shows the parameters of the "Start on-delay timer" instruction:
Parameter

Declaration

Data type

Memory area

Description

<Time duration>

Input

S5TIME, WORD

I, Q, M, D, L or

Duration with
which
the timer
expires.
Timer which
is started.

constant
<Timer>

InOut/Input

TIMER

The number of
timers depends
on the CPU.
For additional information on valid data types, refer to "See also".
Example
The following example shows how the instruction works:

The timer "Timer_1" is started when the signal state of the operand "TagIn_1" changes from "0" to "1". The
timer expires with the timer value of the operand "TagIn_Number". If the timer expires and the RLO has the
signal state "1", the operand "TagOut" is set to "1". If the signal state of the operand "TagIn_1" changes from
"1" to "0" before the timer expires, the timer
is stopped. If the signal state of the operand "TagIn_2" is "1", the timer "Timer_1" is reset, which stops the
timer and sets the current timer value to "0".

---( SS ): Start retentive on-delay timer

Timer operations (S7-1200, S7-1500)

Page 3131 of
33

Description
The "Start retentive on-delay timer" instruction starts a programmed timer when a change from "0" to "1"
(positive signal edge) is detected in the result of logic operation (RLO). The timer expires with the
specified duration, even if the RLO changes to the signal state "0". When the timer expires, the querying
of the timer status for "1" returns the signal state "1". After expiry of the timer, the timer can only be
restarted if it is explicitly reset.
The duration is made up internally of a timer value and a time base. When the instruction is started, the
programmed timer value is counted down towards zero. The time base indicates the time period with
which the timer value is changed.
The "Start retentive on-delay timer" instruction requires a preceding logic operation for edge evaluation
and can only be placed at the right side of the network.
Note
In each case, the instruction decrements a specific value by one unit in an interval that is defined by its time
basis until
the time value is equal to "0". The decrementation takes place asynchronous to the user program. The
resulting timer is
therefore always up to one time interval shorter than the time base.

Parameter
The following table shows the parameters of the "Start retentive on-delay timer" instruction:
Parameter

Declaration

Data type

Memory area

Description

<Time duration>

Input

S5TIME, WORD

I, Q, M, D, L or

Duration with
which
the timer
expires.
Timer which
is started.

constant
<Timer>

InOut/Input

TIMER

The number of
timers depends
on the CPU.
For additional information on valid data types, refer to "See also".
Example
The following example shows how the instruction works:

The timer "Timer_1" is started when the signal state of the operand "TagIn_1" changes from "0" to "1". The
timer expires with the timer value of the operand "TagIn_Number". When the timer expires, the operand
"TagOut" is set to "1". If the signal
state of the operand "TagIn_1" changes from "0" to "1" while the timer is running, the timer is restarted. If the
signal state of
the operand "TagIn_2" is "1", the timer "Timer_1" is reset, which stops the timer and sets the current timer
value to "0".

Timer operations (S7-1200, S7-1500)

Page 3232 of
33

---( SF ): Start off-delay timer


Description
The "Start off-delay timer" instruction starts a programmed timer when a change from "1" to "0" (negative
signal edge) is detected in the result of logic operation (RLO). The timer expires with the specified duration.
As long as the timer is running, the querying of the timer status for "1" returns the signal state "1". If the
RLO changes from "0" to "1" while the timer is running, the timer is reset. The timer is always restarted
when the RLO changes from "1" to "0".
The duration is made up internally of a timer value and a time base. When the instruction is started, the
programmed timer value is counted down towards zero. The time base indicates the time period with
which the timer value is changed.
The "Start off-delay timer" instruction requires a preceding logic operation for edge evaluation and can only
be placed at the right side of the network.
Note
In each case, the instruction decrements a specific value by one unit in an interval that is defined by its time
basis until
the time value is equal to "0". The decrementation takes place asynchronous to the user program. The
resulting timer is
therefore always up to one time interval shorter than the time base.

Parameter
The following table shows the parameters of the "Start off-delay timer" instruction:
Parameter

Declaration

Data type

Memory area

Description

<Time duration>

Input

S5TIME, WORD

I, Q, M, D, L or

Duration with
which
the timer
expires.
Timer which
is started.

constant
<Timer>

InOut/Input

TIMER

The number of
timers depends
on the CPU.
For additional information on valid data types, refer to "See also".
Example
The following example shows how the instruction works:

The timer "Timer_1" is started when the signal state of the operand "TagIn_1" changes from "1" to "0". The
timer expires with the timer value of the operand "TagIn_Number". As long as the timer is running, the
operand "TagOut" is set to "1". If the signal state of the operand "TagIn_1" changes from "1" to "0" while the
timer is running, the timer is restarted. If the signal

Timer operations (S7-1200, S7-1500)

Page 3333 of
33

state of the operand "TagIn_2" is "1", the timer "Timer_1" is reset, which stops the timer and sets the current
timer value to
"0".