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

Toggling Visualizations using HMI Physical Buttons

nmcc
2024-02-12
4 days ago
  • nmcc - 2024-02-12

    Hello, I am extremely new to using codesys. I have an IFM CR1102 HMI with physical buttons on the right side. I need to have these buttons toggle which visualization is active. I currently have ladder logic for when the button is pressed just need the action side for setting the active visualization. Any help is appreciated.

     
  • dkugler - 2024-02-13

    the magic option is named "Use CurrentVisu variable"
    activate this option in the Visualization Manager an have a look:
    https://help.codesys.com/webapp/_visu_obj_manager;product=core_visualization;version=3.5.14.0

    if your button is pressed, "feed" the string varable VisuElems.CurrentVisu := 'visu1'; with the correct name of the depending visu.
    alternative: place a frame element at a empty main visu, konfigure all visus to be shown by this frame.
    With setting the switching variable of the frame to the index value of the depending visu, it will switch to it.
    Advantage: the visu names are not hardcoded as string in the ladder lodgic. Good luck!
    Hint: If you have multiple VisuClients(Target, WebVisu,...) all will show the same visu. Independent switching is much more difficult, but there is a example from codesys.

     
    • nmcc - 2024-02-13

      Hey thank you for the reply dkugler. I am sorry if this seems like a stupid question. I have the use current visuvariable checkbox enabled. I can see the string names of all my visualizations. I am trying to use ladder logic to be the anser to the button press using "VisuElems.CurrentVisu := 'MainScreen';. This returns an error. Any idea what I am doing wrong or could you point me in the right direction for fixing this. Thanks,

       
    • nmcc - 2024-02-13

      Hey thank you for the reply dkugler. I am sorry if this seems like a stupid question. I have the use current visuvariable checkbox enabled. I can see the string names of all my visualizations. I am trying to use ladder logic to be the anser to the button press using "VisuElems.CurrentVisu := 'MainScreen';. This returns an error. Any idea what I am doing wrong or could you point me in the right direction for fixing this. Thanks,

       
  • dkugler - 2024-02-13

    post a screenshot of the ladder and the error message. I'm not able to have a lock at your monitor actually :-)

     
    • nmcc - 2024-02-13

      Here is a screenshot. I really do not know how to format the variable exchange you are talking about.

       
    • nmcc - 2024-02-13

      Here is a screenshot. I really do not know how to format the variable exchange you are talking about.

       
  • dkugler - 2024-02-13

    learn to program in structured text or CFC and forget this antique ladder logic..
    I'm not firm to do that in ladder

     
  • dhumphries - 4 days ago

    Nothing wrong with ladder, in a lot of applications it is simpler than ST or CFC, you're a lot less likely to have syntax issues in a ladder diagram than in structured text as long as you stick with traditional ladder elements.

    Your attempt was almost valid, but you tried to change the currentvisu variable using a blend of structured text and ladder, which isn't allowed. You need to use the MOVE operator and define the visualization name as a string on the input side and the visuelems.currentvisu as the target on the output side.

     

    Last edit: dhumphries 4 days ago

Log in to post a comment.