S7 Input pointer inside multi instance

adamplc

Member
Join Date
Dec 2009
Location
usa
Posts
92
Why does my deconstruction of the input pointer only work with its own instance DB not inside the multi instance FB...See .doc The pointer at the input is P#i258.0


Any help appreciated.
 
Why does my deconstruction of the input pointer only work with its own instance DB not inside the multi instance FB...See .doc The pointer at the input is P#i258.0


Any help appreciated.


The images are not clear enough to decipher them and, I personally can barely understand STL in English so posting it in what appears to be Arabic language is not helpful.
I suggest you describe the problem you are having.
I understand that you are calling a FB with a pointer as actual parameter to one of its inputs.
The problem you are having is that when you instantiate the FB as a single instance you get different result from when you instantiate it as mutliple instance .

My answer is, there should not be any difference. There has to be something else changing the value you are seeing.
 
Last edited:
The problem I have is the area part of the pointer is not pointing to an input location when using it inside a multi instance block call. When using it with its own instance the area pointer is correct.


single instance

16#81000810 = 1000 0001 0000 0000 0000 1000 0001 0000

area crossing pointer of type input


multi instance

16#4010001 = 0000 0100 0000 0001 0000 0000 0000 0001
area crossing pointer of global DB



I don't know why the area pointer is not working inside a multi instance FB and works outside in a single instance.

[FONT=&quot]
[/FONT]
 
I think that it is because you are using temp data for storing. Change temps to stat-area for test.



Are you sure that your animation show temp data for this FB or something later values as temps are writed over on plc scan.
 
:D When I open that doc on my phone it shows some crazy characters but on the laptop it is english.


How did you create your instance FBs?



Have a look at this and see if is helpful.
"Note:
When you create multiple instances, please bear in mind that the FB, which is called as a multiple instance, is always created first and then assigned a multiple instance call. If you do not follow this procedure, there might be inconsistencies in the program. These inconsistencies also occur if you make changes to a multiple instance."
 
When you access an interface variable (except a temp variable) in an FB, the code in the background combines AR2 as the base address and adds the offset for the variable to give the final address to access the variable. This is the basis for multi-instance - AR2 is setup to point to the base address of the interface data for the instance, and then in the instance you refer to the offset. With a single instance AR2 will be set to zero, hence your code works, with a multi instance you need to add AR2 to access the same variable.
 
Last edited:
BTW, in your code snippet you are accessing local data by address (LB 0 etc.) - generally to be avoided as the editor will sometimes use this area and you can get unexpected results.
 

Similar Topics

Hi Guys. I have profinet device that i need to read and write 8 bytes from/to. when I put all the instruction in a FB, I cannot read the 8...
Replies
6
Views
2,693
Hi, I have questions. I have Analog Input that need to put into Ignition Designer. But I don't know how to put?
Replies
1
Views
50
Omron AD081-V1 Analog Input Card Offset & Gain Adjustment Entering Adjustment Mode 1. Set the input card in adjustment mode (Turn ON Dip SW No-1)...
Replies
0
Views
27
Why AMIo800 Analog input module's I/O LED is Lighting up Red? Checked module connections, 4-20ma wires etc but this light is continuously Lighting...
Replies
1
Views
62
I'm getting frustrated creating arrays of variables in Machine edition. I need to make 2 variable arrays that are 102x2 in size, with varying...
Replies
3
Views
88
Back
Top Bottom