Step7 (working memory) FC+DB or FB

sapoleon

Member
Join Date
Aug 2003
Location
salta, salta
Posts
315
I was working with a college, and we had a nice discussion where he told me that according to his experience, it takes less working memory in the plc (S7-3/4xx) writing the control modules (small routines) like an FC and using one big DB for memory purposes.
I never used that method, I normally write the control modules like an FB where I use stat for the values that need to be retentive from cycle to cycle, and then make a nice big FB where I call the small FBs in the stat...

So, more for curiosity... which one is a better approach? and the FC approach really takes less working memory?

thanks.

btw, use less working memory was a bit of a necesity because we were using SW redundancy in with S7-315, and when activating the SW redundancy it uses double of the working memory!
 
This should be a easy enough issue to test in practice. But I guess since you haven't done that you'd prefer a philosophical discussion on the topic.

Every type of block in S7 has a certain minimum amount of memory associated with it - this is an irreducable overhead. Ten empty FCs will use more memory than one empty FC. On that basis, storing 'X' bytes of data in one DB should use less memory than storing the same 'X' bytes in two DBs, which should use less memory than storing 'X' in three DBs, and so on ... since there is only one DB overhead to take in to account.

Ultimately the most economical method would then be one OB for all the code with one DB for all the data. However, there would be so many other potential disadvantages to this in terms of properly structured code and data that I wouldn't recommend taking it to this extreme.

As with everything in life finding the balance in the middle is the goal.

Ken
 
An access to an INT STAT variable in a FB uses the same memory as an access to a global DB using for example L DBW0
If you want a symbolic name for the global DB access then using L DB1.DBW0 uses more memory.
 
An access to an INT STAT variable in a FB uses the same memory as an access to a global DB using for example L DBW0
If you want a symbolic name for the global DB access then using L DB1.DBW0 uses more memory.

That means in a particular FC if iam using DB X in many places then its advisable to use open this DB (using OPN DBX) and then use L DBW0 type reference. Right 👨🏻‍🏫
 
If you change to L DBW0 then you will lose any symbolic addressing and you will have to keep referring to the DB for the description of the variables. I would only do this as a last resort if running out of memory or execution time.
 
Hi, thanks for the replies,

Ken, well I think I was looking for a philosophical answer. I made small tests, but didn't find much of a difference. Not at least with small routines. I don't have much experience with Step7 in order to make quick changes... and, to my disgrace, I learn a lot while working... and to my happiness, I don't have too much free time after work to sit at home to keep working (is not that I don't do that in case of necessity).

I see now that there is no straight answer. It's a little a question of taste, I think is more elegant to make small FB of logic that stores and keeps it's memory, and then make them STAT variables of a bigger FB. In that case we end only with on DB, and at the end it seems to be more or less like one FC that goes to it's DB.

Once again, it seems like a matter of taste if we have the memory... (and ask for a bigger CPU if we run out of it :D!
 

Similar Topics

hi there, three of us have just start working on one project, Step7 v5.5 There is few plc-s in the project and we are all writing software on...
Replies
4
Views
1,582
Hi Guys, Just a quick question (out of interest) Is there in Step7 (not TIA) a function for work hour counting? I had implement those in the...
Replies
2
Views
1,662
Hello all. I'm planing to buy a new laptop. And most of the new laptops don't have a Com port onboard, so I am wondering if any one of you is...
Replies
32
Views
9,653
Hello Inside a FB, I´m trying to transfer a string from a DB to a IN_OUT var that was define as a UDT. The problem is that i can´t determine the...
Replies
4
Views
76
Hi all, I am trying to convert RSLogix 5000 program to Step7. I need to bit shift left my array of double integers for tracking the product on...
Replies
2
Views
504
Back
Top Bottom