Lately I’ve been reading some PLC brochures, I noticed one vendor bragging that his smallest PLC provides 7 types of timers and timing functions, presenting this as a differentiating factor between his PLC and the other brands. As much as the words sound tempting, from a practical point of view, these 7 types have no real value, except for the very lazy PLC programmers.
Don’t get me wrong, timing and sequencing are key functions in any control system, I can easily assume there is no control application that doesn’t contain at least one timer. But dancing around the timer “types” as a selling point just seemed misleading to me.
Practically, you can derive any type of timer or timing function, by correctly utilizing the most basic type of timer, the ON DELAY. Here we will show examples of deriving three types of timers (or timing functions):
- OFF DELAY Timer
- ON+OFF DELAY Timer
- FLASHER
Before we show how, let’s take a look at how the ON DELAY timer works.
The Master of All the Timers! ON DELAY
Compared to a normal relay, a relay is a device that switches its outputs (ON or OFF) immediately with the changes with its input state.
An ON DELAY Timer on the other hand, is similar to a relay, except it “turns the output ON after a certain DELAY”, and that’s how it got its name, ON DELAY. Turning off the output is similar to a normal relay, it happens immediately.
In a ladder diagram, the use of an ON DELAY timer block is very simple, the block receives a COMMAND, and after the preset time has elapsed, the timer output contacts (TM1.OUT) are switched, turning our OUTPUT ON or OFF.
As in the ladder diagram above, all-over this post we are going to use the term COMMAND to indicate the condition to start the timing function, the term OUTPUT to indicate the result of the timing function, and TON DELAY for ON DELAY timer blocks.
OFF DELAY Timer
An OFF DELAY Timer is similar to a relay, except it “turns the output OFF after a certain DELAY”, and that’s how it got its name, OFF DELAY. Turning ON the output is similar to a normal relay, it happens immediately.
Below is a ladder diagram that shows how to derive the above OFF DELAY timing function by utilizing an ON DELAY timer.
The first rung is a simple; once the COMMAND is active the OUTPUT will turn ON immediately, the OUTPUT is self-latched so when the COMMAND is no longer active, OUTPUT stays ON, until the output of the ON DELAY timer “TM1.OUT” is active, that will cut the line feeding OUTPUT and so de-energize it.
Second rung is the timer rung; it simply shows the condition that must exist before the timer should start counting the 3 seconds preset value. COMMAND must be inactive while OUTPUT must be active, this combination guarantees the timer starts only after COMMAND has already been ON and then turned OFF again.
Did you test it on your simulator yet? Works like a charm.
ON+OFF DELAY Timer
As how the name indicates, it’s a combination between the ON DELAY and the OFF DELAY timers, so it introduces a delay before turning OUTPUT ON when the COMMAND is received, and also introduces a delay in turning the OUTPUT OFF when COMMAND is gone.
This one needs two timers:
- One to calculate the delay before turning ON the output (TM1)
- One to calculate the delay before turning OFF the output (TM2)
Note: The above diagram can be consolidated in one rung, yet not all brands of PLC software would allow you to do that, so for clarity and generality let’s keep the rungs separated.
This ladder follows the same methodology as the one used to demonstrate the OFF DELAY timing function, with the addition of a 2 seconds ON DELAY timer to introduce the delay before COMMAND turning OUTPUT ON.
FLASHER Timing Function
This was really funny in the PLC brochure I mentioned in the beginning, the PLC vendor considered that he have two separate types of timers, synchronous flasher (ON time is equal to OFF time), and asynchronous flasher (ON and OFF times are different), what a fluff.
Let me show you here how to make a GENERIC flashing function that works synchronously or asynchronously.
To program any two-step, time based cyclic operation, you need to define two periods (two preset values for two timers):
- The ON period
- The CYCLE period
What you want to do is to have our flasher ON once the COMMAND is active for 1 second (TM1), then have it OFF for 0.5 second, that makes our total CYCLE period 1.5 seconds (TM2), have a look at the ladder diagram below.
OUTPUT is ON when the COMMAND is active, and the timer TM1 is still counting, once TM1 time is elapsed (1 second has passed), OUTPUT will be turn OFF.
The second rung shows how TM1 and TM2 (Cycle timer) are activated. When COMMAND is active both timers start counting, once TM2 preset time of 1.5 seconds is elapsed, it resets both timers using a normally closed contact of TM2.OUT, and the cycle repeats itself.
Now if you want a synchronous flasher, just set TM2 to double the preset value of TM1, any other relation between the two values will give you an asynchronous flasher.
More Timer and Timing Functions
In this article we viewed only three timing functions that can be derived from the standard ON DELAY timer, while still there are more and more than those 7 functions the brochure bragged about.
PULSE timer and PULSE After OFF timer are two types of timing functions that operates based on detecting the transition of COMMAND signal from OFF to ON or vise-versa, regardless of the duration the COMMAND signal has been sustained.
Accumulating timers, as the name indicates, keep accumulating the amount of time the COMMAND has been active, and require a separate RESET input to bring the accumulated value to zero again.
Both above types can be easily implemented by utilizing the ON DELAY timer effectively, and soon separate posts will come about that.
August 11, 2015 at 2:41 pm
I agree, I rarely use anything other than an on delay, and might use other types if they are there but don’t think its a huge selling feature just more crap to look through when programming.
I know one vendor makes you use a different function for time base, one function for second timers and one for millisecond, and while I understand this is done for processor optimization i still find it annoying
LikeLike
August 11, 2015 at 2:51 pm
I agree, it’s very annoying Kyle, and what bothers me more is that even it is done for processor optimization, as that vendor is the OWNER of the source code of his software, he could have done that optimization behind stage, while compiling your program, giving you a single easy to use function and leaving for himself such differentiation based on time base in the background.. But NO, they have to list in their brochure that they have 500+ function blocks.
LikeLike
August 27, 2015 at 10:07 pm
What a rich article freshed my memory of some good exercises I really enjoyed it but I think providing some types of timers will decrease number of rungs written and make the program more obvious and clear.
I am with you that some vendors provide more than needed function blocks.but the function I won’t use doesn’t make it useless.
What is the point of replacing one function block like” tof” with 2 rungs.
LikeLike
August 27, 2015 at 11:04 pm
No use at all.. that’s not what I said in the article.. my point is to demonstrate that you can do anything with the ON delay… yet i am not recommending replacement of existing functions if they already exist… but if they don’t exist you don’t need to get a higher PLC…
LikeLike
September 15, 2015 at 8:19 am
ya i know that most of brand of plcs giving more timing functions in this way but instead that only one timer which should have only three function like on delay time bit,running time bit and enable bit.
LikeLike
November 12, 2015 at 12:06 pm
I enjoy reading your blogs Shady. But I don’t fully agree with your comments in this case, it’s a bit lopsided view, I am sorry. Yes, theoretically your article makes a lot of sense. You are right in saying that the vendor shouldn’t brag about the types of timers as a differentiating feature. However, glorifying that ON-Delay timer is everything in timer/timing programming is a bit too much to say.
Let me explain my view. Yes, it is possible to realize all timing functions with a simple on-delay timer. As experienced programmers, we all know that. But for an average programmer it doesn’t make much sense to use this “one-timer” approach for everything. In your examples you have some transitional contacts (one scan cycle ON) which is by far difficult for many programmers to conceive in the first place. One has to have a clear understanding of the scanning concept (of course a programmer need to know this). I have been a PLC trainer cum project engineer myself for close to 20 years now and I know what I am talking about.
This one-type timer approach confuses the masses, but using the right timer really reduces complexity to a great extent. Have you considered the maintenance engineer’s plight when they troubleshoot this kind of a timing logic if there is a problem? This transitional contacts can never be visualized on the screen and people go frenzy seeing such logics. Also, you can’t do such cryptic programming especially with a safety PLC! Don’t you agree that the people that come from hard-wired logic (who are familiar with different timing concepts, on-delay, off-delay, pulse etc.) find it easy to understand PLC programming when use the timers with the right designations? Because I have seen the pain of people from changing their way of thinking (from hard-wired control to PLC control) when they start using PLCs.
So my suggestion to the programmers would be,
1. Use the right timer for the right application type for the easy understanding of all (programmers and maintenance engineers) at all stages (during programming & troubleshooting).
2. Also using the right timer reduces many interlocking contacts. At times, it even reduces the number of rungs and contacts. This would reduce the scan time greatly.
3. I have witnessed that criss-crossing of timers doesn’t work in the right way in many cases (I have worked extensively with Siemens S5, S7 & Allen Bradley SLC-500, PLC-5) But I agree, all the examples you cited here would work perfect.
Lastly, one can also argue that we don’t need timer at all….we could use the system flashing bits and with counter one can realize many different timing actions.
LikeLike
November 12, 2015 at 12:37 pm
Thank you Isaac for the extensive comment, I’ve received several comments with the same meaning, but yours is the most illustrative and informative.
I would argue one point here, the article never RECOMMENDED to replace all timers with ON-DELAY, yet it shows that if other timers doesn’t exist, no need to panic, everything is can be done with ON-DELAY.
I think the main problem in this article is it’s title, in my search for a “google friendly”, I landed on a misleading one :)..
Thanks again..
LikeLike
November 12, 2015 at 12:50 pm
No worries Shady!
My points were just to help the budding PLC programmers. Because in SIMATIC S5 PLCs, if you scan a timer contact (T1 as NO in one rung and NC in another rung) more than once in a single scan, it simply malfunctions. In fact Siemens manual suggest not to use such timer contacts and instead one has to use the internal memory bit assigned to the timer contact. I have experienced same trouble with Allen Bradley PLCs too. We did all these kind of tests way back in 1995 for benchmarking.
Your articles are very interesting and informative too. Quite useful and so do keep up with blogging. Have a great day!
LikeLike
March 8, 2016 at 12:29 pm
How to use one timer to on the load for 5 seconds and after five seconds off the load
LikeLike
December 2, 2016 at 3:00 pm
is it a must to preset timers for cycle period to 1.5 sec or its just an example?
LikeLike
December 6, 2016 at 10:43 pm
Thank you for the article!
LikeLike
July 6, 2017 at 11:14 am
Thanks for the article.
I have some questions about, I’ve tried to put in the flashing program on S 1200, and really it makes no sense, because it does flashing, but it doues with a cycle time flushing, also I’ve tried to adjust timers, and it gave me delay betweet flashing, but not the propper time of light on (it is still on only within a cycle time).
Can you help me or explain what is happening there?
LikeLike
July 21, 2017 at 12:14 pm
Hello. Many new PLCs do not work properly. The problem is probably the compilation.
LikeLike
July 27, 2017 at 2:23 am
Great source of information about PLC , It’s very helpful for automation engineer.
LikeLike
August 24, 2017 at 2:32 am
I am student of automation ,Very informative & valuable information about PLC.
LikeLike
August 25, 2017 at 2:28 am
Very helpful for information for electrical engineers.
LikeLike
October 30, 2017 at 7:27 pm
nice very helpful
LikeLike
February 26, 2018 at 5:13 pm
Thanks for helping me learn more about on delay timers. I actually didn’t know that these were similar to normal relays. I’m kind of interested to see if there is a visual difference between these, especially if you need to tell the different between the two.
LikeLike
August 11, 2018 at 1:20 pm
Nice Blog and very helpful for us. To learn more about PLC visit our site
LikeLike
October 8, 2018 at 7:22 pm
https://siemensplctraining.wordpress.com
LikeLike
October 21, 2019 at 2:56 pm
“soon separate posts will come about that.” I have searched for these posts that you said were coming, and here it is 2019 and no posts.
LikeLike
May 19, 2020 at 12:48 pm
Great read!
When I use timers I often monitor the time to get the best result by using periodic tasks so that the timing of the program or ladder is more accurate in the sense of being used correctly.
What are your thoughts?
LikeLike
May 17, 2021 at 11:56 am
PLC SCADA Online Training Institute in Noida as per the current industry standards. Our training programs will enable professionals to secure placements in MNCs. We are providing our world-class training facilities for all the students who want to become professional.
LikeLike