I'm having trouble working out how to pass the EIP devices FB instances into my function block since each EIP device has a different name and IEC Object type.
I have just tested this and can access all the parameters of the device for example.
I need a way to pass that whole instance into my function block, maybe using in-out variable, reference/pointer or something. But I can't do this easily because I need to declare the instance inside the function block and each instance has a different name.
Is there a way to use the input/output of the function block to pass the instance?
If I can just pass _3G3AX_MX2_EIP_A4055_v1_4_FB into my function block without having to declare it inside of my function block. I can then use my one VSD FB and just assign each EIP device to my function block and won't have to map hundreds of variables and It's easy to add and change stuff etc in the future
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I take it this is not possible in CodeSys currently since everything has to be declared as static, I have been researching and reading into OOP and some of the limitations with CodeSys, I see there is the _NEW for dynamic memory, but does not look like a robust solution. Am I best just going back to the traditional method of mapping data?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi there,
I'm having trouble working out how to pass the EIP devices FB instances into my function block since each EIP device has a different name and IEC Object type.
I have just tested this and can access all the parameters of the device for example.
Now I can create an instance:
I can now use that drive instance:
The Problem I have is codesys creates an FB per device with different name/instance...
I need a way to pass that whole instance into my function block, maybe using in-out variable, reference/pointer or something. But I can't do this easily because I need to declare the instance inside the function block and each instance has a different name.
Is there a way to use the input/output of the function block to pass the instance?
If I can just pass _3G3AX_MX2_EIP_A4055_v1_4_FB into my function block without having to declare it inside of my function block. I can then use my one VSD FB and just assign each EIP device to my function block and won't have to map hundreds of variables and It's easy to add and change stuff etc in the future
I take it this is not possible in CodeSys currently since everything has to be declared as static, I have been researching and reading into OOP and some of the limitations with CodeSys, I see there is the _NEW for dynamic memory, but does not look like a robust solution. Am I best just going back to the traditional method of mapping data?