Siemens S7-1200 System Manual page 217

Hide thumbs Also See for S7-1200:
Table of Contents

Advertisement

Timer programming
The following consequences of timer operation should be considered when planning and
creating your user program:
● You can have multiple updates of a timer in the same scan. The timer is updated each
● You can have scans during which no update of a timer occurs. It is possible to start your
● Although not typical, you can assign the same DB timer structure to multiple timer
● Self-resetting timers are useful to trigger actions that need to occur periodically. Typically,
Time data retention after a RUN-STOP-RUN transition or a CPU power cycle
If a run mode session is ended with stop mode or a CPU power cycle and a new run mode
session is started, then the timer data stored in the previous run mode session is lost, unless
the timer data structure is specified as retentive (TP, TON, TOF, and TONR timers).
When you accept the defaults in the call options dialog after you place a timer instruction in
the program editor, you are automatically assigned an instance DB which cannot be made
retentive. To make your timer data retentive, you must either use a global DB or a Multi-
instance DB.
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
time the timer instruction (TP, TON, TOF, TONR) is executed and each time the
ELAPSED or Q member of the timer structure is used as a parameter of another
executed instruction. This is an advantage if you want the latest time data (essentially an
immediate read of the timer). However, if you desire to have consistent values throughout
a program scan, then place your timer instruction prior to all other instructions that need
these values, and use tags from the Q and ET outputs of the timer instruction instead of
the ELAPSED and Q members of the timer DB structure.
timer in a function, and then cease to call that function again for one or more scans. If no
other instructions are executed which reference the ELAPSED or Q members of the timer
structure, then the timer will not be updated. A new update will not occur until either the
timer instruction is executed again or some other instruction is executed using ELAPSED
or Q from the timer structure as a parameter.
instructions. In general, to avoid unexpected interaction, you should only use one timer
instruction (TP, TON, TOF, TONR) per DB timer structure.
self-resetting timers are created by placing a normally-closed contact which references
the timer bit in front of the timer instruction. This timer network is typically located above
one or more dependent networks that use the timer bit to trigger actions. When the timer
expires (elapsed time reaches preset value), the timer bit is ON for one scan, allowing the
dependent network logic controlled by the timer bit to execute. Upon the next execution of
the timer network, the normally closed contact is OFF, thus resetting the timer and
clearing the timer bit. The next scan, the normally closed contact is ON, thus restarting
the timer. When creating self-resetting timers such as this, do not use the "Q" member of
the timer DB structure as the parameter for the normally-closed contact in front of the
timer instruction. Instead, use the tag connected to the "Q" output of the timer instruction
for this purpose. The reason to avoid accessing the Q member of the timer DB structure
is because this causes an update to the timer and if the timer is updated due to the
normally closed contact, then the contact will reset the timer instruction immediately. The
Q output of the timer instruction will not be ON for the one scan and the dependent
networks will not execute.
Basic instructions
7.2 Timer operations
217

Advertisement

Table of Contents
loading

Table of Contents