Step7: UC FB's - UDT's & Global DB's lol

STL???

Member
Join Date
Sep 2005
Location
UK
Posts
879
Hopefully someone can validate my thoughts on the following:

I'm looking at a proposed program design for a line which will be with us early next year, The style of programming is very similar to S7Guys concept.

Each Station has 9 FB's and 1 DB containing a Master UDT made up of smaller UDT's.

e.g Station 1 FB10 - 19, DB10
Station 2 FB20 - 29, DB20

in FB10 the call is structured as follows

Code:
OPN DI10
LAR2 P#0.0
UC FB11 - St1DatenLesen 
UC FB12 
to
UC FB19 - St1DatenSchreiben
FB11 to 19 contain The Master UDT in the STAT area so it seems the station data is available to all blocks.

Now to the questions!!

FB11 "Datenlesen" is where Inputs are Mapped, however under what conditions could AR2 be screwed up?

I thought at first if i loaded a different DB variable and transfered it to Station Data that would mess with the IDB number? but it would be ok i think because the different DB number would be stored in the global DB register not the instance leaving AR2 in tact.

Other than the recompilation of UDT's in the event of change and the loss of goto location i don't see any problems - what do the Guru's think?

Thanks for taking the time to read this and any advice offered.
 
For recompiling yes.

If for example you add a word to a UDT which is in the middle of a DB or STAT area, if you don't have symbolic selected all your code would be 1 word out after that insertion.

If symbolic is selected, then it will re-address the the logic to the new locations of the symbols that have been pushed down.
 
For recompiling yes.

If for example you add a word to a UDT which is in the middle of a DB or STAT area, if you don't have symbolic selected all your code would be 1 word out after that insertion.

If symbolic is selected, then it will re-address the the logic to the new locations of the symbols that have been pushed down.

Gotcha - I can see why this would be so important Thanks

The other thing i was pondering on was the LAR2 P#0.0 Part.

I thought Address register 2 pointed automatically to the start of an instance DB so the LAR2 P#0.0 is a redundant?
 
Last edited:
Gotcha - I can see why this would be so important Thanks

The other thing i was pondering on was the LAR2 P#0.0 Part.

I thought Address register 2 pointed automatically to the start of an instance DB so the LAR2 P#0.0 is a redundant?

Depends on where those calls are.

AR2 is not modified by opn di10 if that is what you mean.
 
Depends on where those calls are.

AR2 is not modified by opn di10 if that is what you mean.

What i mean is after DB10 is opened as an instance - is AR2 automatically initialized to point to the start of the IDB? if this is the case the LAR2 P#0.0 instruction in the example i was sent is not needed?

I tried an example in PLCSIM and it works fine without the LAR2 P#0.0 - i just wondered if there was another reason to include it?
 
If your IDB consists of several 'object records / UDTs), you will use AR2 to point to the actual one. I presume ...

Kalle

Hi Kalle,

This i could understand,but with one DB per station, the offset will always be at the beginning of each station DB.
 
Here is the code the editor produces when you type in

CALL FB1,DB111

AR2 points to the base address of the instance data - AR2 only gets modified when you perform multiple instance calls.

fbi.JPG
 
Last edited:
Here is the code the editor produces when you type in

CALL FB1,DB111

AR2 points to the base address of the instance data - AR2 only gets modified when you perform multiple instance calls.

Thanks LD - think ill go away for a while and digest all this :)
 

Similar Topics

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
145
Hi All, Can anyone help with my problem and you save my day .. I´ve made a FB which I am to use as a multi instance. I want to pass data...
Replies
8
Views
10,601
I have some data in a FB. Said data is visible in the FB's DB. I would like to have this data in a UDT and then move it to another location...
Replies
13
Views
9,973
What are UDTs and What is their significance in step7????? Thanx in advance for any help....
Replies
2
Views
2,886
Hello. I have searched the forum and did not find the answer for this: I am using a S7315-2DP plc. I have made one prgram that uses udt's as...
Replies
4
Views
6,495
Back
Top Bottom