View Full Version : How to work with IEC timers in Simems S7?

April 15th, 2005, 06:20 AM
Is it possible to create multi instance datablock when you use iec timers (SFB4 - SFB5) in Siemens S7? It will be a lot of datablock if you have to create a new one for each timer you put in your program.

April 15th, 2005, 08:04 AM
i was told (haven't checked it tho) that you could use 1 instance DB for more than one timer.
so for example T1-T9 all with DB0

April 15th, 2005, 11:26 AM
By all means yes, use a multi-instance DB or as you point out you will use up a DB for each instance of an IEC timer.

April 15th, 2005, 02:54 PM
Having never programmed a Siemens S7 or any Siemens for that matter, what the heck is an IEC timer? I wonder about such terms. It makes one think that somehow time is different in Siemens land. I would assume that all timers have a time base, a way to set a preset and a way to see or use the accumulated time as the timer runs. Bits that are available from the timer that help you use it in a program for such things as on delay and off delay timing at the bit level. But, then I do not know all that there is to know about these things, so I am interested to know what an IEC timer in PLCs really is. Seriously!

Terry Woods
April 16th, 2005, 12:47 PM

Here's what Siemens says...


April 16th, 2005, 04:42 PM
Thanks, Terry! Now I know why I have never programmed a Siemens PLC. You have to wonder about the degree of fog built into an explanation like that one. I am not sure that I would know the difference in an IEC timer or a SIMATIC timer after reading that several times. It would probably take me a couple of programs before I got the understanding of their instructions. Sounds a lot like a PYA statement. It is interesting though, and always good to learn new things.

Terry Woods
April 16th, 2005, 05:38 PM

I ain't so crazy about the way IEC has developed.

I prefer the TI Timer. There is only one type of Timer. It is an ON-Delay and it is Retentive (although, not through a power-cycle unless you save and reload the accumulated value, which is very easily accomplished). However, it is Retentive in that when the Input goes off the accumulated time remains until you activate the Reset. That means you can resume timing as you wish.

When the timer times out, it does not keep running like some timers do.

The "Run-Timer", "Reset-Timer" and "Timer-Output" are all in the same rung. With this timer, anyone can easily build an OFF-Delay Timer.

And the number of timers available is limited only by the basic size of your memory. That is, if you wanted to, you could assign more memory to Timers than Ladder.

All of the "fancy features" associated with AB type timers (Timed Out, Running & NOT Timed Out, etc.) are available with the TI Timer through simple boolean conditions.

April 17th, 2005, 07:00 AM

I started out in this business when the 5TI was one of the leading "relay replacers" being sold and installed. I did some early programming with them and found no special problem getting the job done. Since Siemens bought the old TI PLC line, I have not had the opportunity to work with them. The Allen-Bradley equipment became my PLC of choice in the early days, mostly by chance more so than design. If you remember, there were not all that many to choose from back then. I figure the IEC is ok in some respects but changing things just because you can, still eludes me. I think the whole ISO 9000 thing is fine, but can lead to making some things more complicated than is really necessary. We must have come from about the same era.

April 17th, 2005, 05:17 PM
And the number of timers available is limited only by the basic size of your memory. That is, if you wanted to, you could assign more memory to Timers than Ladder.

Not quite sure which timers you're referring to here. I don't know the 200's or 400's, but in the 300's, the above statement would apply to IEC timers, but not to S5-Timers, the number of which is limited according to processor type, e.g. for a 317-2 DP 512 S5-Timers.

Terry Woods
April 17th, 2005, 05:43 PM

I was talking about TI Timers and TI Memory Management.

This certainly does NOT apply to IEC or ANY of the S7 PLCs.


I am very sorry that you missed out on the TI-505 line (specifically, the 555 and 575 Processor). They represent the ultimate in terms of providing all of the capabilities necessary to do anything.

I really, really wish that someone had the where-with-all to buy the TI-505 line from Siemens. Siemens intends to KILL the ultimate PLC! Just to pump their own piece of **********!

Gee, I wonder how much money us TI-Regulars could throw together to possibly buy and save the TI-505 line? We could all be in on the ground floor of the BEST!

I'm in for $100-Grand! Please... serious folks only!


April 17th, 2005, 06:10 PM
I only saw a few of the 505 line, Terry. Never got the chance to work with them. Based on your assessment, I wish I had gotten to. The plant I was in at the time was convinced that Modicon or Allen-Bradley was the way to go. After working with a Micro84, I realized that I never wanted to program many Modico PLCs. I fiddled with a 184 a bit, and it was just as confusing and confounding as the Micro was later. The AB at least was something that seemed to be fairly straight forward. However, it did take me a little head scratching to get onto XIO and XIC but then the same confusion was a hurdle with the Modicon too. I kept treating the instructions as if the PLC knew what I had hooked up to the input module. Silly me! But as it turns out, I was not the only one caught in that web. Fortunately I got my mind right and never looked back. Damn, those were fun days!

Terry Woods
April 17th, 2005, 09:02 PM
Modicon is among the worst.

April 17th, 2005, 10:11 PM
I love MSDOS, I cant believe this crazy Windows cr*p.

Lets buy out Microsoft too.

Ken M
April 18th, 2005, 04:02 AM

The reason for multiple timer types in Siemens S7 goes back to the days when everybody, including the beloved TI, had their own way of controlling time. Most maufacturers had their own design on what a timer should look like, how it should behave, what the limits of acceptable values were, what timebases were available etc. Siemens, in their venerable S5 range, had several timer functions all based around a common way of holding a time value in a 16-bit register. This single variable held both the timebase and the magnitude of the time value. The S7 range then inherited this timer type as a form of backward compatibility with S5 structures.

I appreciate that to all good ol' boys on your side of the pond the IEC must seem like a pinko commie conspiracy led by those cheese-eating surrender monkeys in Europe, but I still believe there are elements of value in the 61131-3 software document. One of the most valuable of these is the idea of absolutely standard data types across all manufacturers. This includes a variable type called TIME. The next obvious extension of this is standard functions for manipulating these data types. So the IEC standard defines three simple timers: an on-delay, an off-delay and a pulse generator. S7 includes these standard IEC timers as well.

Finally, Siemens even have an instruction library entitled TI-S7 Conversion Library which includes as many of your favourite TI operations as you could hope for. Function FC80 is basically the TI timer function coded for S7.

So with S7 you've got the possibility of using S5 timers, if that's where you've come from; TI timers, if that's where you've come from; or IEC timers if you want to make your code transportable. I know some people get very confused with all this (which one should I use?) but it's a bit like complaining a dictionary has too many words: nobody says you have to use them all, just take the ones you need.