Counters - Siemens SIMATIC S7-1200 Manual

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

Advertisement

Self-resetting timers are useful to trigger actions that need to occur periodically. Typically,
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.
The -(TP)-, -(TON)-, -(TOF)-, and -(TONR)- timer coils must be the last instruction in a
network. As shown in the timer example, a contact instruction in a subsequent network
evaluates the Q bit in a timer coil's IEC_Timer DB data. Likewise, you must address the
ELAPSED element in the IEC_timer DB data if you want to use the elapsed time value in
your program.
The pulse timer is started on a 0 to 1 transition of the Tag_Input bit value. The timer runs for
the time specified by Tag_Time time value.
As long as the timer runs, the state of DB1.MyIEC_Timer.Q=1 and the Tag_Output value=1.
When the Tag_Time value has elapsed, then DB1.MyIEC_Timer.Q=0 and the Tag_Output
value=0.
6.3.6

Counters

You use the counter instructions to count internal program events and external process
events.
● The "count up" counter (CTU) counts up by 1 when the value of the input parameter CU
● The "count down" counter (CTD) counts down by 1 when the value of input parameter CD
● The "count up and down" counter (CTUD) counts up or down by 1 on the 0 to 1 transition
S7-1200 also provides high-speed counters (Page 115) (HSC) for counting events that occur
faster than the OB execution rate.
Easy Book
Manual, 11/2011, A5E02486774-04
changes from 0 to 1.
changes from 0 to 1.
of the count up (CU) or count down (CD) inputs.
6.3 Powerful instructions make programming easy
Programming made easy
107

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents