FB_INIT in library

alexgooi
2024-05-22
2024-05-23
  • alexgooi

    alexgooi - 2024-05-22

    Dear Forum,

    I currently have a challenge. I have a library with some communication classes. These communication classes need to be linked to an interface like this:

    Devices_and_controllers.Comm_Frame.Modbus_GVL_Link.KNX_TCP[Interface_Index] := THIS^;

    This is executed via a FB_Init() method. When I try to do this in a program this works fine. But when I declare the FB_Init() in the library the FB_Init() method is being called but the link is not made (interface still has the value 0000000000). The Objects and interfaces are defined in the library (GVL), so I’m assuming the data should be there.
    When I call the FB_Init method explicitly in the program it also works fine.
    Whys is this not working when it is all defined in the library? And is it even possible to create a structure like this in Codesys?

    Kind regards

    Alex

     

    Last edit: alexgooi 2024-05-22
  • alexgooi

    alexgooi - 2024-05-23

    Hi Paro, I have tried this and it seemed to have solved the problem, thank you very much!

     

Log in to post a comment.