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.
inHMI : MyFunctionBlockInHMI;
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.
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
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!
have you added the library to your application library manager?
Then every visualization should be visible in the frame element.
I had to restart the project before they were visible.
It works as expected now.
Log in to post a comment.