Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Timer operations
This chapter contains the following information:
IEC Timers
This chapter contains the following information:
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
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)
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
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
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".
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
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
D, L
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.
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.
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
Memory area
Description
I, Q, M, D, L or
Duration with
constant
D, L
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.
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
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
D, L
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".
IEC_TIMER structure.
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
D, L
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".
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.
<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
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".
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.
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
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:
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
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".
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
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".
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
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.
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
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.
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
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.
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".
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.
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".
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".
Page 3232 of
33
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
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".