|
Timers
Let's
now see how a timer works. What is a timer? Its exactly what the word
says... it is an instruction that waits a set amount of time before doing
something. Sounds simple doesn't it.
When we look
at the different kinds of timers available the fun begins. As always,
different types of timers are available with different manufacturers.
Here are most of them:
- On-Delay
timer-This type of timer simply "delays turning
on". In other words, after our sensor (input) turns on we wait
x-seconds before activating a solenoid valve (output). This is the most
common timer. It is often called TON (timer on-delay), TIM (timer) or
TMR (timer).
- Off-Delay
timer- This type of timer is the opposite of the on-delay
timer listed above. This timer simply "delays turning off".
After our sensor (input) sees a target we turn on a solenoid (output).
When the sensor no longer sees the target we hold the solenoid on for
x-seconds before turning it off. It is called a TOF (timer off-delay)
and is less common than the on-delay type listed above. (i.e. few manufacturers
include this type of timer)
- Retentive
or Accumulating timer- This type of timer needs 2 inputs.
One input starts the timing event (i.e. the clock starts ticking) and
the other resets it. The on/off delay timers above would be reset if
the input sensor wasn't on/off for the complete timer duration. This
timer however holds or retains the current elapsed time when the sensor
turns off in mid-stream. For example, we want to know how long a sensor
is on for during a 1 hour period. If we use one of the above timers
they will keep resetting when the sensor turns off/on. This timer however,
will give us a total or accumulated time. It is often called an RTO
(retentive timer) or TMRA (accumulating timer).
Let's now see how to use them.
We typically need to know 2 things:
- What
will enable the timer. Typically this is one of the
inputs.(a sensor connected to input 0000 for example)
- How
long we want to delay before we react. Let's wait 5
seconds before we turn on a solenoid, for example.
When the instructions before
the timer symbol are true the timer starts "ticking". When the
time elapses the timer will automatically close its contacts. When the
program is running on the plc the program typically displays the elapsed
or "accumulated" time for us so we can see the current
value. Typically timers can tick from 0 to 9999 or 0 to 65535 times.
Why the weird numbers?
Again its because most PLCs have 16-bit timers. We'll get into what this
means in a later chapter but for now suffice it to say that 0-9999 is
16-bit BCD (binary coded decimal) and that 0 to 65535 is 16-bit binary.
Each tick of the clock is equal to x-seconds.
Typically each manufacturer
offers several different ticks. Most manufacturers offer 10 and 100 ms
increments (ticks of the clock). An "ms" is
a milli-second or 1/1000th of a second. Several manufacturers also
offer 1ms as well as 1 second increments. These different increment timers
work the same as above but sometimes they have different names to show
their timebase. Some are TMH (high speed timer), TMS (super high speed
timer) or TMRAF (accumulating fast timer)
Shown below is a typical timer
instruction symbol we will encounter (depending on which manufacturer
we choose) and how to use it. Remember that while they may look different
they are all used basically the same way. If we can
setup one we can setup any of them.

This timer is the on-delay
type and is named Txxx. When the enable input
is on the timer starts to tick. When it ticks yyyyy
(the preset value) times, it will turn on its contacts that we will use
later in the program. Remember that the duration of a tick (increment)
varies with the vendor and the timebase used. (i.e. a tick might be 1ms
or 1 second or...)
Below
is the symbol shown on a ladder diagram:
In this diagram we wait for
input 0001 to turn on. When it does, timer T000 (a 100ms increment timer)
starts ticking. It will tick 100 times. Each tick (increment) is 100ms
so the timer will be a 10000ms (i.e. 10 second) timer. 100ticks
X 100ms = 10,000ms. When 10 seconds have elapsed, the T000 contacts
close and 500 turns on. When input 0001 turns off(false) the timer T000
will reset back to 0 causing its contacts to turn off(become false) thereby
making output 500 turn back off.
Click
here and
view the animation to really learn!
An
accumulating timer would look similar to this:

This timer is named Txxx.
When the enable input is on the timer starts to tick. When it ticks yyyyy
(the preset value) times, it will turn on its contacts that we will use
later in the program. Remember that the duration of a tick (increment)
varies with the vendor and the timebase used. (i.e. a tick might be 1ms
or 1 second or...) If however, the enable input turns off before the timer
has completed, the current value will be retained. When the input turns
back on, the timer will continue from where it left off. The only way
to force the timer back to its preset value to start again is to turn
on the reset input.
The
symbol is shown in the ladder diagram below.
In this diagram we wait for
input 0002 to turn on. When it does timer T000 (a 10ms increment timer)
starts ticking. It will tick 100 times. Each tick (increment) is 10ms
so the timer will be a 1000ms (i.e. 1 second) timer. 100ticks X 10ms =
1,000ms. When 1 second has elapsed, the T000 contacts close and 500 turns
on. If input 0002 turns back off the current elapsed time will be retained.
When 0002 turns back on the timer will continue where it left off. When
input 0001 turns on (true) the timer T000 will reset back to 0 causing
its contacts to turn off (become false) thereby making output 500 turn
back off.
Click
here and
view the animation to really learn!
One important thing to note
is that counters and timers can't have the
same name (in most PLCs). This is because they typically
use the same registers.
Always remember that although
the symbols may look different they all operate the
same way. Typically the major differences are in the duration of
the ticks increments.
|