S7: Multiple Instance timers in 1 DB

douyi

Member
Join Date
Aug 2005
Location
Toronto
Posts
123
If I have an instance DB which includes all the IEC timers (hundreds of), and the FB itself has all the block calling functions (such as call SFB4 as multiple instance call), the way to active the timers is to passby a bit which connected to "IN".

And I have some FCs which include some logic to active timer by
send out high level of the bit which connected to "IN".

I think there is no problem when the current FC (is actived I can access timers' ACC value. The question is, after execution of current FC and go to next FC, can I still access that specific timer's ACC value?

For example:

I have FB1 called "All timers", and instance DB for FB1 is DB1 called "All_Timers_DB", inside FB1 I have timers from TON_1 to TON_100.

Timer Called this way:

...
CALL #TON_1
IN:=DB100.DBX1.1
PT:=T#2H
Q :=DB100.DBX1.2
ET:=DB100.DBD14
...

And I also have FC1 to FC10, each of them has 10 timers.

Timer called like this:

...
A DB101.DBX0.1
= DB100.DBX1.1
...

Does it work?

when the program execute to FC1, the timer should be actived by passing the bit status. But once the program exectuing FC2, is that timer still alive? so it's still updating the "DB100.DBD14"? or it's only update DB1.TON_1.ET?

Thanks.
 
It will work.
However, I strongly advice you to use symbolic address priority when programming (and to turn symbols on).

To your second question:
The IEC timer is only updated when it is scanned. So the IN, PT, Q and ET values will not change "in between".
If you are qurious how it works, then I can tell that it works by copying the CPU actual time at the moment it is enabled. The expired time is then calculated at every scan by subtracting the initial time from the actual CPU time.
Opening the instance DB online while the timers are running gives a look at how it works, try it.
 
Thank you, JesperMP.

The reason I ask this question is I don't have any hardware right now and have to finish the programming as much as I can, it's a little bit hard for a Siemens beginer, isn't it?
 
It is a really good idea to get something to test and learn on.

Either get the PLCSIM software option, or get the CPU on your desk for you to use while you are programming.
You have to get a CPU anyhow, so just get the CPU first and when you are finished install it in the control panel. In that way it will not cost you anything extra.
 

Similar Topics

Hi, I have an issue about the choice for FC or FB in my standardisation... 📓 My current standard is: FC + UDT on a IN/OUT parameter +...
Replies
12
Views
4,295
Hi All, I have created an FB with a mulitple instance Data block, I use the block 4 times in my program ( only have one data block), however the...
Replies
19
Views
19,394
Hi, Need some help with this problem, i have declerate an udt for that in/output regards Berra
Replies
8
Views
1,767
I know how the multiple instance FB works and i can program them, no problem there. I also know that I can save on the amount of used FB's/DB's...
Replies
1
Views
3,599
multiple instance Data block in step7 programming reduce the number of instance data blocks....Does it saves memory also...if yes then how?????
Replies
13
Views
5,891
Back
Top Bottom