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.
the magic option is named "Use CurrentVisu variable"
activate this option in the Visualization Manager an have a look:
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.
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,
post a screenshot of the ladder and the error message. I'm not able to have a lock at your monitor actually :-)
Here is a screenshot. I really do not know how to format the variable exchange you are talking about.
learn to program in structured text or CFC and forget this antique ladder logic..
I'm not firm to do that in ladder
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.
Log in to post a comment.