I have a very simple question. I have 2 FBs with some input & output parameters. I want to take the output of 1 FB & use it in the 2nd FB. (irrespective of the instance of FB)
One way is that maybe i can use GVL. But i dont want to do so as i am making a library & not end application(PLC program)
Is their any other way to get data of a 1st FB instance in a 2nd FB??
Maybe using some interfaces?? Could someone post an example??
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am not sure. If you do something like FB1_Name.FB_Variable in the second FB you get an error that "Functionblock 'FB1_Name' must be instantiated to be accessed.
For my own libraries I just make an output variable in the first FB and an input variable on the second but I can see why you would want to do it your way. Though I'm unsure what would happen with multiple instances of FB 1.
Hello,
I am a library developer & new to CodeSys.
I have a very simple question. I have 2 FBs with some input & output parameters. I want to take the output of 1 FB & use it in the 2nd FB. (irrespective of the instance of FB)
One way is that maybe i can use GVL. But i dont want to do so as i am making a library & not end application(PLC program)
Is their any other way to get data of a 1st FB instance in a 2nd FB??
Maybe using some interfaces?? Could someone post an example??
I am not sure. If you do something like FB1_Name.FB_Variable in the second FB you get an error that "Functionblock 'FB1_Name' must be instantiated to be accessed.
For my own libraries I just make an output variable in the first FB and an input variable on the second but I can see why you would want to do it your way. Though I'm unsure what would happen with multiple instances of FB 1.
Looking through the help file quickly I'm wondering if Parameter transfer by reference might work for you.
What about this?
FUNCTION_BLOCK BASE
VAR_STAT
Shared: INT;
END_VAR
FUNCTION_BLOCK FB_1 EXTENDS BASE
FUNCTION_BLOCK FB_2 EXTENDS BASE
Last edit: tvm 2020-12-30