Timer Programming Tips And Examples - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

Program instructions
7.17 Timer
7.17.2

Timer programming tips and examples

Timer types
You can use timers to implement time-based counting functions. The S7-200 instruction set
provides three different types of timers.
● On-Delay Timer (TON) for timing a single interval
● Retentive On-Delay Timer (TONR) for accumulating a number of timed intervals
● Off-Delay Timer (TOF) for extending time past an off (or false condition), such as for
cooling a motor after it is turned off
Addressing timer values
The meaning of the T number depends on the context in your program.
● "T37" assigned to a timer box identifies which timer is to use.
● "T37" assigned to normally open contacts addresses the Boolean T37 timer bit.
● "T37" assigned to integer operations addresses the T37 current time value, as a data
word.
1-millisecond resolution
The 1-ms timers count the number of 1-ms timer intervals that have elapsed since the active
1-ms timer was enabled. The execution of the timer instruction starts the timing; however,
the 1-ms timers are updated (timer bit and timer current) every millisecond asynchronous to
the scan cycle. In other words, the timer bit and timer current are updated multiple times
throughout any scan that is greater than 1 ms.
The timer instruction is used to turn the timer on, reset the timer, or, in the TONR timer, to
turn the timer off.
Since the timer can be started anywhere within a millisecond, the preset must be set to one
time interval greater than the minimum desired timer interval. For example, to guarantee a
timed interval of at least 56 ms using a 1-ms timer, the preset time value should be set to 57.
10-millisecond resolution
The 10-ms timers count the number of 10-ms timer intervals that have elapsed since the
active 10-ms timer was enabled. The execution of the timer instruction starts the timing;
however the 10-ms timers are updated at the beginning of each scan cycle (in other words,
the timer current and timer bit remain constant throughout the scan), by adding the
accumulated number of 10-ms intervals (since the beginning of the previous scan) to the
current value for the active timer.
Since the timer can be started anywhere within a 10-ms interval, the preset must be set to
one time interval greater than the minimum desired timer interval. For example, to guarantee
a timed interval of at least 140 ms using a 10-ms timer, the preset time value should be set
to 15.
380
System Manual, V2.3, 07/2017, A5E03822230-AF
S7-200 SMART

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-200 smart

Table of Contents