What are Timers? || How to use Timers || Using Timers in Simatic manager
Timer Functions:
Timer
functions are used to implement timing sequences. For example, waiting and
monitoring times,
measuring
of time intervals, generation of pulses. The timer functions are stored in
system memory of
the CPU.
The following timer types are available:
·
Pulse Timer
· Extended Pulse Timer
· On delay Timer
· Retentive On Delay Timer
· Off Delay Timer
· Extended Pulse Timer
· On delay Timer
· Retentive On Delay Timer
· Off Delay Timer
Timers
have an area reserved for them in the memory of your CPU. This memory area
reserves one
16-bit
word for each timer address. The ladder logic instruction set supports 256
timers. Please refer to
your CPU’s
technical information to establish the number of timer words available. The
following
functions have access to the
timer memory area:
·
Timer instructions
·
Updating of timer words by means of clock timing.
This
function of your CPU in the RUN mode decrements a given time value by one unit
at the interval
designated
by the time base until the time value is equal to zero.
For any timer there are
three inputs and three outputs as shown in the below figure.
Time Value: Bits 0 through 9 of the
timer word contain the time value in binary code. The time value
specifies
a number of units. Time updating decrements the time value by one unit at an
interval designated
by the
time base. Decrementing continues until the time value is equal to zero. You
can load a time value
into the
low word of accumulator 1 in binary, hexadecimal, or binary coded decimal (BCD)
format.
You can pre-load a time
value using either of the following formats:
W#16#wxyz
Where w = the time base (that is, the time
interval or resolution)
Where xyz = the time value in binary coded
decimal format
S5T#aH_bM_cS_dMS
Where H = hours, M = minutes, S = seconds, and MS
= milliseconds; a, b, c, d are defined by the user.
·
The time base is selected automatically, and the
value is rounded to the next lower number
with that time base.
NOTE: The maximum time value that you
can enter is 9,990 seconds, or 2H_46M_30S.
Time Base: Bits 12 and 13 of the timer
word contain the time base in binary code. The time base
defines
the interval at which the time value is decrement by one unit. The smallest
time base is 10 ms;
the
largest is 10 s.
Time Base Binary Code for the Time Base
10 ms 00
100 ms 01
1 s 10
10 s 11
Values
that exceed 2h46m30s are not accepted. A value whose resolution is too high for
the range
limits
(for example, 2h10ms) is truncated down to a valid resolution. The general
format for S5TIME has
limits to
range and resolution as shown below:
Resolution Range
0.01
second 10MS to 9S_990MS
0.1
second 100MS to
1M_39S_900MS
1 second 1S to 16M_39S
10 seconds 10S to 2H_46M_30S
Bit configuration in the ACCU1: When a timer is started, the contents of ACCU1 are used as the time
value.
Bits 0 through 11 of the ACCU1-L hold the time value in binary coded decimal
format (BCD formats:
each set
of four bits contains the binary code for one decimal value). Bits 12 and 13
hold the time base in
binary
code. The following figure shows the contents of the timer cell loaded with
timer value 127 and a
time base of 1 second:
S5TIME DATA TYPES for
Time values:
Data Type Length
(bits) Format Format Examples
S5time 16 bits s5t#_h__m__s__ms s5t#10ms, s5t#2H30m45s
Choosing the right Timer: This overview is intended to help you choose the right timer for your
timing
job
FR Enable
Timer (free):
When the RLO transitions from "0" to "1", FR <timer> clears the edge-detecting flag that is used for
starting the addressed timer. A change in the RLO bit from 0 to 1
in front of an enable instruction (FR)
enables a timer. Timer enable is not required to start a timer,
nor is it required for normal timer
instruction. An enable is used only to re-trigger a running timer,
that is, to restart a timer. The restarting
is possible only when the start instruction continues to be
processed with RLO = 1.
Time
Specifications:
·
Fixed time values specified as time
constants (e.g.: S5T#100ms, S5T#35s, S5T#5m2s200ms,
·
S5T#2h2m2s50ms).
·
Time values to be changed by the
machine operator using push wheel buttons.
·
Process or recipe-dependent time
values in memory words or data words.
Timer Cell: A
special area of memory is reserved for timers in your CPU. This area contains a
16-bit word
for each timer address. bits 0 to 9 of the timer word contain the
time value in binary code. When the timer
is updated, the time value is decremented by one unit at the
interval defined by the time base.
L / BI: The
address at the “BI” output contains the time value in the form of a 10-digit
binary number
(without time base!).
LC / BCD: The
address at the “BCD” output contains both the time value as a 3-digit BCD
number (12bits) and the time format (bits 12 and 13).
Note: IEC-compliant timers can also be implemented in STEP7. The
system function blocks need to be used for implementing IEC timers.
TYPES OF TIMERS:
Pulse Timer: S_PULSE (Pulse S5 Timer) starts the specified timer if there is a
positive edge at the start
(S)
input. A signal change is always necessary in order to enable a timer. The
timer runs as long as the
signal
state at input S is "1", the longest period, however, is the time
value specified by input TV. The
signal
state at output Q is "1" as long as the timer is running. If there is
a change from "1" to "0" at the S
input
before the time interval has elapsed the timer will be stopped. In this case
the signal state at output Q
is
"0". The timer is reset when the timer reset (R) input changes from
"0" to "1" while the timer is running.
The
current time and the time base are also set to zero. Logic "1" at the
timer's R input has no effect if the
timer is
not running. The current time value can be scanned at the outputs BI and BCD.
The time value at
BI is
binary coded, at BCD it is BCD coded. The current time value is the initial TV
value minus the time
elapsed
since the timer was started.
If the
signal state of 0.7 changes from "0" to "1" (positive edge
in RLO), the timer T4 will be
started.
The timer will continue to run for the specified time of thirty-five seconds
(35 s) as long as I0.7
is
"1". If the Signal State of I0.7 changes from "1" to
"0" before the timer has expired the timer will be
stopped.
If the Signal State of input I0.5 changes from "0" to "1"
while the timer is running, the time is
reset.
The output Q8.5 is logic "1" as long as the timer is running and
"0" if the time has elapsed or
was
reset.
Extended Pulse Timer: S_PEXT (Extended Pulse Timer) starts the specified timer if there is a
positive
edge at
the start (S) input. A signal change is always necessary in order to enable a
timer. The timer
runs for
the preset time interval specified at input TV even if the signal state at the
S input changes to
"0"
before the time interval has elapsed. The signal state at output Q is
"1" as long as the timer is
running.
The timer will be restarted ("re-triggered") with the preset time
value if the signal state at input
S changes
from "0" to "1" while the timer is running. The timer is
reset if the reset (R) input changes
from
"0" to "1" while the timer is running. The current time and
the time base are set to zero. The
current
time value can be scanned at the outputs BI and BCD. The time value at BI is
binary coded, at
BCD is
BCD coded. The current time value is the initial TV value minus the time
elapsed since the timer
was
started.
If the
signal state of 0.7 changes from "0" to "1" (positive edge
in RLO), the timer T4 will be
started.
The timer will continue to run for the specified time of thirty five seconds
(35 s) even if I0.7 is
"0".
If the Signal State of input I0.5 changes from "0" to "1"
while the timer is running, the timer is reset.
The
output Q8.5 is logic "1" as long as the timer is running and
"0" if the time has elapsed or was
reset.
Also the output Q8.5 does not depend on the Input I0.7.
On-Delay Timer: S_ODT (On-Delay S5 Timer) starts the specified timer if there is a
positive edge at
the start
(S) input. A signal change is always necessary in order to enable a timer. The
timer runs for
the time
interval specified at input TV as long as the Signal State at input S is
positive. The signal state
at output
Q is "1" when the timer has elapsed without error and the signal
state at the S input is still "1".
When the
Signal State at input S changes from "1" to "0" while the
timer is running, the timer is stopped.
In this
case the signal state of output Q is "0". The timer is reset if the
reset (R) input changes from "0"
to
"1" while the timer is running. The current time and the time base
are set to zero. The signal state at
output Q
is then "0". The timer is also reset if there is a logic
"1" at the R input while the timer is not
running
and the RLO at input S is "1". The current time value can be scanned
at the outputs BI and
BCD. The
time value at BI is binary coded, at BCD is BCD coded. The current time value
is the initial
TV value
minus the time elapsed since the timer was started.
If the
signal state of input I0.7 changes from "0" to "1"
(positive edge in RLO), the timer T4 will be
started.
The timer will continue to run for the specified time of thirty-five seconds
(35 s) as long as if I0.7
is
"1". If the Signal State of input I0.5 changes from "0" to
"1" while the timer is running, the timer is
reset.
The output Q8.5 is logic "1" only when timer is elapsed and
"0" if the input I0.7 is “0”.
Retentive On-Delay S5 Timer: S_ODTS (Retentive On-Delay S5 Timer) starts the specified timer if
there is
a positive edge at the start (S) input. A signal change is always necessary in
order to enable a
timer.
The timer runs for the time interval specified at input TV even if the signal
state at input S changes
to
"0" before the time interval has elapsed. The signal state at output
Q is "1" when the timer has
elapsed
without regard to the signal state at input S. The timer will be restarted
(re-triggered) with the
specified
time if the signal state at input S changes from "0" to "1"
while the timer is running. The timer is
reset if
the reset (R) input changes from "0" to "1" without regard
to the RLO at the S input. The signal
state at
output Q is then "0". The current time value can be scanned at the
outputs BI and BCD. The
time
value at BI is binary coded, at BCD it is BCD coded. The current time value is
the initial TV value
minus the time elapsed since the timer was started.
If the
signal state of I0.7 changes from "0" to "1" (positive edge
in RLO), the timer T4 will be started.
The timer
runs without regard to a signal change at I0.7 from "1" to
"0". If the signal state at I0.7
changes
from "0" to "1" before the timer has expired, the timer
will be re-triggered. The output Q8.5 will
be
"1" if the timer elapsed. If the signal state of input I0.5 changes
from "0" to "1", the time will be reset
irrespective
of the RLO at S.
Off-Delay Timer: S_OFFDT (Off-Delay S5 Timer) starts the specified timer if there is a
negative edge
at the
start (S) input. A signal change is always necessary in order to enable a
timer. The signal state at
output Q
is "1" if the signal state at the S input is "1" or while
the timer is running. The timer is reset
when the
signal state at input S goes from "0" to "1" while the
timer is running. The timer is not restarted
until the
signal state at input S changes again from "1" to "0".The
timer is reset when the reset (R) input
changes
from "0" to "1" while the timer is running.The current time
value can be scanned at the outputs
BI and
BCD. The time value at BI is binary coded, at BCD it is BCD coded. The current
time value is the
initial
TV value minus the time elapsed since the timer was started.
If the
signal state of I0.7 changes from "1" to "0" (negative edge
in RLO), the timer T4 will be started.
The timer
runs without regard to a signal change at I0.7. If the signal state at I0.7
changes from "0" to
"1"
before the timer has expired, the timer will be re-triggered. The output Q8.5
will be "1" as soon as
I0.7 is “1”
& resets only when timer is elapsed. If the signal state of input I0.5
changes from "0" to "1",
the time
will be reset & output becomes zero.
To watch the tutorial video click : What are Timers? || How to use Timers || Using Timers in Simatic manager
Comments
Post a Comment