How to use UDT as inout in a FB

xyz102

Member
Join Date
Jun 2012
Location
NL
Posts
3
Hi All,
I am new to this forum so don't flame on me if i forgot to do sth or did not do it precisely :D

I have the same problem as was already mentioned before in a thread:
http://www.plctalk.net/qanda/showthread.php?t=43994
I´ve made a FB which I am to use as a multi instance.
I want to pass data in/out of this FB and therefore I made a UDT with the structure of the data.

In the FB I declare a new inout with datatype of the above UDT, I´m using an inout since there are data which I should both read and write to in this struct.
I made the code in the FB, so far so good ..

Next step I called the FB above from another FB, but when trying to declare data at the actual inoutI all time get a fault that says the data on the actual side are not matching the data in the FB I call.

The problem is basically with passing the UDT IN_OUT structure from the Higher FB to the lower FB. I don't understand the solution in the thread mentioned above as its is 4 years old, picture missing and the project opens corrupted on my PC.

Does anyone know how to solve this problem? I would be really grateful.

I am using Simatic S7 V5.5 + SP2 and CPU 315-2 DP.
 
Last edited:
You cannot pass a IN_OUT UDT parameter from a calling FB as an IN_OUT UDT parameter to a called FB. You will need to revise your program structure.
 
I have already done it by separating the data into IN and OUT UDTs.
But can you tell me exactlly why it is not possible to pass IN_OUT UDT parameter from a calling FB as an IN_OUT UDT parameter to a called FB?
A pointer error? I just don't get it why it is possible to do it with IN or OUT UDTs and not IN_OUT?
 
IN and OUT parameters of type UDT are passed by value (i.e. the data is copied to/from the instance DB), for IN_OUT parameters of type UDT they are passed by reference (pointer) and hence cannot be passed on.
 
This is strange for me, bacause i have an expereience with C++ and pointer to a pointer is not a problem there. Thought Siemens know how to handle this kind of stuff. Great thanks for the explanation though. (y)

Case solved.
 

Similar Topics

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,594
Afternoon all, I'm working on setting up a large excel recipe table for porting updates through the Linx Gateway RTD/DDE function into my recipe...
Replies
2
Views
110
I am trying to copy an array of real numbers into a UDT with a real data type element. I have attached a snip below showing my COP instruction...
Replies
4
Views
203
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
128
Does anybody have any samples of how to "Create and Use" UDT's in CCW Developer Edition? (I am using v22) I can't find any information from...
Replies
3
Views
311
Back
Top Bottom