Static addressing in siemens

Sparks

Member
Join Date
May 2005
Posts
8
Hi all,
I am at the moment writing a plc program in siemens for the first time. I am using the static area for addressing all the required tags. Is it possible to write to these addresses in another function block??. i have tried putting the tag names in speech marks as described in the siemens help but this does not seem to work.

Thanks
 
Symbols that are defined in the symbol table are acessible via the symbolic names throughout all program blocks (i.e. M2.0 = "PilotVoltageON").

Symbols that are defined in the declaration area in FBs and FCs are only available within the same FB or FC (i.e. #Start_Command).

If an instance DB is generated for an FB, then symbols that are a combination of the DBs symbol and the FB declaration symbols are generated (i.e. "Motor1".Start_Command). These instance DB symbols are available globally as well.

Are symbols turned ON ?
 
Sparks

The Static variables declaration area of an FB only has 'physical' relevance once you have created an instance data block associated with that FB. All these Static variables are held in there, along with the In, In_Out and Out parameters. Temps are not retained between execution cycles and exist only at the time of execution in memory allocated from the local stack.

So if you have an FB named "Control" which contains a Static variable named "Action", there is no way of addressing an entity called "Control".Action - it has no existence. However when you call "Control" and assign an instance data block called "Valve1", you can then read/write the entity called "Valve1".Action. And so on for "Valve2".Action and any other IDBs etc.

Some people I've spoken to have strong ideas about whether you should control an FB's Static variables from outside that FB. It does seem to be a personal thing. If you want to exchange data between FBs should you formally use declared parameters to do this rather than just poke data in to the Stats? If everything goes via parameters then modularity of code can be much better maintained. However this may not be high up your list of priorities. Reading/writing Stats is perfectly permissible provided you do all the appropriate housekeeping - how many sources are there for the data, how do you prevent overwriting, how do you know when data has been updated etc?

Regards

Ken
 
Some people I've spoken to have strong ideas about whether you should control an FB's Static variables from outside that FB. It does seem to be a personal thing.



Hans Berger points out in his STL book that Instance DBs are logically identical to normal DBs and there is absolutely no problem with accessing them globally. Personally, I stick to reading them, but that's just a personal habit.
 
Hi guys, Thanks for the quick reply. I have assigned a instance data block to the function blocks. When i start to type the required symbol name only the static data associated with the current function block are shown. Should i be able to see all the symbols from each function block?.

Here is an example so you can se what i am doing wrong

create a static data called 'Test1' which is located in FB10 and has an instance data block DB108 assigned to it.

if i want to address this in another FB (Say FB14) would i just type "Test 1"

Thanks again Daniel
 
Hi Sparks

Nope. Remember that you could potentially have multiple calls to FB10, each with its own unique set of parameters and circumstances. If you try addressing something called "Test1", how does the system know which of these many "Test1"s you actually mean?

Take your DB108, give it a (meaningful) symbolic name in the Symbol Table, say, "Trial", and then make reference to "Trial".Test1
Now the system knows that you're referring to the Test1 that resides in the DB named Trial as opposed to any other Test1.

Regards

Ken.
 
Reading/writing Stats is perfectly permissible provided you do all the appropriate housekeeping - how many sources are there for the data, how do you prevent overwriting, how do you know when data has been updated etc?

I use access to instance DBs from outside the declaring FBs extensively. It really boosts my productivity by allowing me to program symbolically rather than with absolute addresses.
There are pitfalls indeed, but I avoid them with two measures:
1. Select Symbolic Address Priority (not Absolute Address Priority). STEP7 then takes care of most of the housekeeping for you.
2. Create and test your FBs extensively before using them on a large scale in your program. Once you have started to use the FBs for reusable objects, you should not touch them. You CAN change them, but it takes some care and experience.
 
The static addressing seems fine only problem that i habve now have is it does not seem to allow you to do a search 'Go To - Location' for a static address. After a search it comes up with nothing found?? even though it is used several times.
 
Sparks said:
The static addressing seems fine only problem that i habve now have is it does not seem to allow you to do a search 'Go To - Location' for a static address. After a search it comes up with nothing found?? even though it is used several times.

You can only look for a STAT within it's own Block as far as I'm aware (in other words if your in OB1 for example you won't be able to "Go To" the entry in the Instance DB).

Within the Block if you click on the STAT variable that you want to find, and then use the Edit -> goto command (CTRL-SHIFT-F for forward search, --B for backwards) then you can step through all the placs in the block where it's used.
 

Similar Topics

Hi, i am writing a FB to control a Conveyor Segment, this will be duplicated depending on how many Segments are in the system. I am looking to...
Replies
5
Views
3,044
guys: I have a problem with my IP configuration. my organization networking has 2 subnets. 10.0.0.25 and 10.1.0.25 both under 255.255.255.0 all...
Replies
2
Views
565
Hi Yes, I'm stuck again. Trying to define a Function Block. What I've put in there so far has been a straight copy/paste from the code (and that...
Replies
22
Views
2,870
Hi; In our Corrugator plant, there are automatic WIP conveyors having two moving carts also. System contains 17 items (server, two PCs, Siemens...
Replies
6
Views
2,428
HI All.It the matter of losing the JOB. I want to write a script in Archestra or in intouch where i have to perform the Tag validation. I need...
Replies
2
Views
1,383
Back
Top Bottom