Timers in S7 300 plc

Donnchadh

Lifetime Supporting Member
Join Date
Jun 2002
Location
Ireland
Posts
1,004
Hi All

I am new to the world of siemens S7 (have been mostly Allen Bradley) but I am getting more into the Siemens s7 and I am starting to like it.
I have been used to Allen Bradley, Omron etc. I may have it wrong but is there a small no of timers in a S7 300.
If I use a FC and I have a timer in it do I use one of the S7300
timers evertime I call this.

Sorry if this is a dump question but I am trying to think siemens and not Alllen Bradley.
There will be more dump question to follow!!

Donnchadh K
 
There are a limited number of instruction type timers available, but there are IEC timers available such as SFB4, these are endless.

They require an instance DB, but if you specify them as STAT's inside FB's then they will become part of the main FB's instance DB.

If they are called from an FC, each one would require their own IDB.


EDIT: If you call a FC several times and it contains a timer, then this will not work for you, each timer can only be used once per scan (usually).
 
Hi Peter

Thanks for the quick reply.
Is a IDB just like a normal DB.
Am I correct that with FB,s that you must have a DB with it.
Sorry again about the dumb question bit like I said I am
new to S7 and am trying to get my head around it.
 
Donnchadh

Your original point is very valid - there are a ridiculously small number of 'native' timer/counters in the S7-300 and S7-400 range. I've no idea what Siemens was thinking about there. CPUs with megabytes of memory addressing thousands of I/O and only 256 timers? Oh well ...

An IDB is pretty much like an ordinary DB expect it is associated to an FB. Every FB must have an instance data block. That can either be expressed as a separate IDB for every call of every FB or, as PeterW suggested, by embedding FBs in a larger parent FB and then just having one big instance DB for the parent which also holds all the children's data.

You could for example call -
FB99, DB49
FB99, DB50
FB99, DB51 etc

Or create an FB100. Inside it declare three instances of FB99 in the STAT memory area and then call -
FB100, DB100

You'll find that the DB100 automatically contains three identical sets of data, one for each of the instances of FB99 you declared.

For small simple FBs, like the SFB3 or SFB4 timers, you can declare several hundred instances of these in one of more parent FBs. The only limit is the amount of memory in your CPU.

Ken
 
HI Ken



Thanks for that.Siemens is a big change for me and I am trying to THINK Siemens.It is very differnet from what I am used to and I say different not worse as I have an open mind and I must say S7 has some very nice thinks about it and also some very different thinks I am trying to get used to.I will have a go on my test rig tomorrow or Sunday (sad or what)
You may see some more dump questions and please reply with great answers like both Peter and Ken.

Thanks again.
 
Can you be more specific about your FC; is it going to be called from lots of different places or is it just a convenient block for one area of processing that is called once ?
 
Hi L D[AR2,P#0.0]

Its a general question but seen as I have a you attention.
Lets say I want to call the FC in a number of places in the code
would this make a differance?
Donnchadh K
 
If you refer to a specific timer inside the FC, this timer will be used for all calls, probably with disasterous consequences !

If you want to use a different timer for each call, then you can add the timer number as a parameter to the FC and specify a different timer number at each call.

If you want to use the IEC timers, don't use an FC but use an FB as already mentioned in the previous posts.
 
Hi L D[AR2,P#0.0]

Thanks for that.I understand that if I call an FC more than once
with the same timer it would be like calling a output more than once.I will set up some FB's with timers and see how this works.

Thanks again.
 

Similar Topics

Dear all colleagues and members I have worked for a company and I created a program for them for small automation but they dont want to give my...
Replies
12
Views
4,701
Hello friends I start newly plc programing with S7 300 but I dont know how to set and S_CU up counter, can any one help me about that with all...
Replies
4
Views
6,094
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,361
Hi, I'm looking for a way to pause the timers I have in my PLC. I'm making a program which has a safety switch which is supposed to pause the...
Replies
5
Views
2,132
Hi all, I probably have some short questions for you. I'm trying to understand timers and the Siemens operating system in more detail...
Replies
9
Views
12,340
Back
Top Bottom