Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Codesys visualizations in custom library

Anonymous
2018-03-24
2020-08-10
  • Anonymous - 2018-03-24

    Originally created by: benjaminjorgensen

    Hello. I am creating a codesys.library that will consist of a function block. The function block shall be ran on several devices in one single project. In the library I have a struct of HMI tags (inputs to function block) that will be triggered from a codesys webvisu. The visualization shall lie in the library, as each instance of the function block shall have a corresponding visualization.

    ie.
    STRUCT MyFunctionBlockInHMI

    FUNCTION_BLOCK MyFunctionBlock
    VAR_INPUT
    inHMI : MyFunctionBlockInHMI;
    END_VAR

    Now how do I proceed to map the structs tags to the buttons variable field in my visualization?
    I tried mapping the buttons with ie. "MyFunctionBlock.inHMI.booleanvariable."
    I then imported the library into a test project, called an instance of the function block in my main task, and added a webvisu of the type contained in my library. I get errors associated to the tags mapped to the visu buttons, saying that the function block need to be instantiated.

     
  • Lo5tNet - 2018-03-28

    You need to create an instance of that function block. You do this by creating a variable like: fb_MyFunctionBlock : MyFunctionBlock somewhere in your program (POU/GVL).

    Then you can access the input variables by doing: fb_MyFunctionBlock.inHMI.booleanvariable

     
  • maartengoris - 2020-08-07

    Hi,

    I have the same problem here,

    the visualization shall lie in the library, as each instance of the function block shall have a corresponding visualization.

    I also think this a good approach, the visu element is in the same lib as the function block,
    But i cannot add the visualisation in my project, they are not listed in the available visualisation elements.

    Any idea how i can select them?

    Thanks in advance!

     

    Last edit: maartengoris 2020-08-07
  • m.prestel - 2020-08-10

    Hello @maartengoris,
    have you added the library to your application library manager?
    Then every visualization should be visible in the frame element.

    Best regards,
    Marcel

     
    • maartengoris - 2020-08-10

      Marcel,

      I had to restart the project before they were visible.
      It works as expected now.

      Thanks!

       

      Last edit: maartengoris 2020-08-10

Log in to post a comment.