Siemens Simatic S7-200 System Manual page 202

Programmable controller
Hide thumbs Also See for Simatic S7-200:
Table of Contents

Advertisement

Instruction Set
Understanding the S7-200 Timer Instructions
You can use timers to implement time-based counting functions. The S7-200 provides two
different timer instructions: the On-Delay Timer (TON), and the Retentive On-Delay Timer
(TONR). The two types of timers (TON and TONR) differ in the ways that they react to the
state of the enabling input. Both TON and TONR timers time up while the enabling input is
on: the timers do not time up while the enabling input is off, but when the enabling input is off,
a TON timer is reset automatically and a TONR timer is not reset and holds its last value.
Therefore, the TON timer is best used when you are timing a single interval. The TONR timer
is appropriate when you need to accumulate a number of timed intervals.
S7-200 timers have the following characteristics:
Timers are controlled with a single enabling input, and have a current value that
maintains the elapsed time since the timer was enabled. The timers also have a preset
time value (PT) that is compared to the current value each time the current value is
updated and when the timer instruction is executed.
A timer bit is set or reset based upon the result of the comparison of current value to the
preset time value.
When the current value is greater than or equal to the preset time value, the timer bit
(T-bit), is turned on.
Note
Some timer current values can be made retentive. The timer bits are not retentive, and are
set only as a result of the comparison between the current value and the preset value.
When you reset a timer, its current value is set to zero and its T-bit is turned off. You can
reset any timer by using the Reset instruction, but using a Reset instruction is the only
method for resetting a TONR timer. Writing a zero to a timer's current value does not reset its
timer bit. In the same way, writing a zero to the timer's T-bit does not reset its current value.
Several 1-ms timers can also be used to generate an interrupt event. See Section 10.14 for
information about timed interrupts.
Updating Timers with 1-ms Resolution
The S7-200 CPU provides timers that are updated once per millisecond (1-ms timers) by the
system routine that maintains the system time base. These timers provide precise control of
an operation.
Since the current value of an active 1-ms timer is updated in a system routine, the update is
automatic. Once a 1-ms timer has been enabled, the execution of the timer's controlling
TON/TONR instruction is required only to control the enabled/disabled state of the timer.
Since the current value and T-bit of a 1-ms timer are updated by a system routine
(independent from the programmable logic controller scan and the user program), the current
value and T-bits of these timers can be updated anywhere in the scan and are updated more
than once per scan if the scan time exceeds one millisecond. Therefore, these values are
not guaranteed to remain constant throughout a given execution of the main user program.
10-14
S7-200 Programmable Controller System Manual
C79000-G7076-C230-02

Advertisement

Table of Contents
loading

Table of Contents