S7 Iec Timers VS. S5Timers

BNA

Member
Join Date
Sep 2003
Location
Give
Posts
117
Hi´

I have been using S5timer for the last decade, but every time I have to change the timers from a HMI Panel the problems start, and as I can se in this forum I am not the only one.o_O

So now im trying to switch over to IEC timers, but I don´t like that I have to use one DB for each timer ! Is there a way to use a shared Db ? I am not so fammiliar with UDT blocks and so on, so a little help would be appreciated.

Thanks in advance.
Brian
 
Use function blocks and use timers as multi-instance. Declare timer variables in fb's stat.

There is also other ways, but that is really what you should do.
 
That would be a way to do it, if somebody is doing this another way I would like to hear about it.

As I see it the S5timers is still the easy way of programming timer although they will give other problems.
 
Hi
As turbo said create an FB, call it timers
then in the stat area add however many SFB04 you want. Add this with a db to your code.

Then any where you can use DBxx.Timerxx. EN and Q and PRE to call these timers
 
Hi
As turbo said create an FB, call it timers
then in the stat area add however many SFB04 you want. Add this with a db to your code.

Then any where you can use DBxx.Timerxx. EN and Q and PRE to call these timers

Not sure if its just mistakenly described wrong there but the solution given is false. (EDIT: reads like multi calls to the same FB to me, maybe wrong in my interpretation though).

If you created a FB with all your timers then you would need to call THAT FB to run through each timer consecutively.

Alternatively, to do what was described above, you would need to formulate a way to offset the IDB to the particular timer you want.

Or a simple method perhaps an input to point to the FB Timer to enable an offset jump internally to the correct timer that block ends afterwards.
 
Last edited:
My plan was to make one Fb with all timers in as suggested, and then Call This Fb in my Ob1 together with the other calls, here I will assign a Db for This Fb, This should work as far as I Can see. Or what ??
 
Yes it would work, only your max error of time is two scans. It would be easy to loop them trough with some pointer logic & unconditional call.

What I meant in my first answer was that you would use FB's for all your code. I think FC's should be used only when there is exactly one return variable.
 
Last edited:
Hi
to clarify the above, call the FB every scan inside OB1, and use the DB notation wherever you wish

As others have already said you will be max of 2 scans out which in most cases does not matter

Alternatively use FB's and embed the timers inside the relevant FB (like Turbo said)
 
It is possible to make a global timer DB/FB, but try to think over if it smart or not.

I suggest use multiple instances the way it is meant to.
Create reusable code by writing "object" FBs. Embed the objects necessary IEC timers in the FBs.
 
Do you mean that I have to create one DB for each timer or to create Them in the Fb Stats area ?
 
BNA, I feel your pain. You have to jump through hoops to just put a timer preset on a HMI screen.o_O
 
Do you mean that I have to create one DB for each timer or to create Them in the Fb Stats area ?

If you declare timer in fb's stat. timers data is in its parent fb's db.

That fb can also be declared in other fb's stat. Basically, one could do fb "valve" that has two timers (jams for two limit switches) then have as many of these valves as necessary declared in parent fb's stat that controls them. All with just one datablock (ofc if need be you can structure your program with more datablocks).

Jesper meant, that you should not do one fb containing all timers, but use them like they should be. that is what i tried to describe above.
 

Similar Topics

I've used the following timer code in S7-300's for a long time. When migrated to an S7-1500 plc, the timer behaviour changes so that I no longer...
Replies
22
Views
5,404
I've tried to add an "s" after the tag for the PT value of an IEC timer but it's rejected, even if the tag type is "time". As the timebase is ms...
Replies
4
Views
2,128
Hi I did quick hacks for TP and TOF to get reset functions in them. Here is the source: FUNCTION_BLOCK TPR TITLE = Resettable Pulse Timer...
Replies
3
Views
2,614
Heya im doing a small program in gx iec developer 7 and havnt really programmed in years so some help with this would be nice im programming an...
Replies
6
Views
5,476
Hello, I want to create a FC function that uses SCL code that checks deviation of a controllers actual measured value from its setpoint and then...
Replies
3
Views
7,116
Back
Top Bottom