B&R function in ST doesnt return Structure or array

xtheking

Member
Join Date
Apr 2019
Location
Berlin
Posts
2
Hi all

I am currently working with an B&R controller using structured text. I have some code, that has previously worked with CODESYS, but when I use exactly the same code in B&R, it gives me this error "Function '....' returns array, string or structure" (Error code 1210). It seems to me that Function in B&R can only return basic data type. But when I read the Help document of Automation Studio, it says that "The function supports return values of the basic types, data types derived from the basic types, enumerations, structures, arrays and string types" . This confuses me.
Do you have any ideas how I could work around this problem?
Thanks
 
Can you post the code? I can see if I can recreate it in my Automation Studio.

You may need to change the function to output to a reference or pointer.
 
Hi Seth, thank you for replying.

The following is an example from B&R documentation

(.typ file)
TYPE
McPointType : STRUCT
X : LREAL;
Y : LREAL;
Z : LREAL;
END_STRUCT;
END_TYPE

(.fun file)
FUNCTION P : McPointType
VAR_INPUT
X : LREAL;
Y : LREAL;
Z : LREAL;
END_VAR
END_FUNCTION

(.st file)
FUNCTION P
P.X := X;
P.Y := Y;
P.Z := Z;
END_FUNCTION

btw this function should be in a library, so I can reuse it.
 

Similar Topics

I am new to this forum and would need your help. I am looking for the Modbus FBs for the S5 95U for communication with the CP521. These FBs...
Replies
0
Views
9
Hi, I have attached herewith one image which our programmer has been used in S7 1500 PLC. Now we need to use the same instructions in S7 1200 PLC...
Replies
4
Views
150
Im trying to create a level indicator for water Tank i have used the ADD function while the pump is on and level increasing everything works...
Replies
33
Views
1,273
Good morning crew! Ok my logic works but I am missing something. When the start button is pushed it should like the red light for 4sec then shut...
Replies
13
Views
482
Please see attached file. I need this program in Function Block form but I am totally lost on this. Any help would be appreciated. Thanks!
Replies
8
Views
342
Back
Top Bottom