I have to think there is a way to do this, but I cannot make it work.
I have a Visu screen with a bunch of Rectangles being used for text entry. There is a combo box that will allow the operator to switch between 15 different input location. See attached image.
So, let's just look at the Top Left Rectangle. What I am trying to make happen is:
If the ComboBox Integer value = 1, then the Rectangle Text Variable = GVLP.arSPCal2TC.rX
If ComboBox = 2, Text Variable = GVLP.arSPCal3TC.rX
if ComboBox = 3, Text Variable = GVLP.arSPCal4TCB.rX
(not going to list all 15 options).
I cannot do this as an array because the function boxs I am using with these variables will not work with arrays. I have tried, unsuccessfully.
What I am wondering is can I set the Text Variable property of the Rectangle to be the output of a string variable? LIke, I set the Text Variable property to "sTCrx1" and it the property instead of just reading the string, actually uses the string value as the text variable.
Does this even make sense??
Sorry for the delay in getting back to you, got buried in a bunch of other work. I looked over what you did, but I ended up sticking with the multiple frame approach. Only for the fact that with the multiple frames, I can set limits when I use "Write Variable" input.
you can use a function in your text variable.
See attached project.
Of course I cannot open your project. I am assuming this is because I am not using the most current version of Codesys. The PLC that I am using requires me to use Codesys 3.5 SP9 Patch 6.
you can always use CODESYS 3.5 SP16 and download your application to a PLC with version 18.104.22.168.
Depending on your PLC, you may not be able to update the visu profile or compiler version, but you should always be able to use a later IDE to make a download to a older PLC.
Never the less I saved the project in a way, so you can open it with CODESYS 3.5 SP9
I should probably add this is my first Codesys project. So I do not know all the real ins and outs when it comes to versions. my PLC came with the installer for 3.5 SP9 Patch 6, so its all I know to use.
I am able to open you project and see how you are using the Function to set the strong for Text Variable. One last (I hope) follow up. I need to change the Text Variable on 24 Rectangle Entities. The Function seems to only want to let me change 1 Variable. do I have to create 24 separate functions or can I do all of this in a single function? It doesn't seem to like if I set the Function Output to a string array.
You can adjust this function in any way you need to.
E.g. you can add a variable iComboboxIndex as VAR_INPUT in your function.
Then use a CASE and return a different value depending on your selected index.
For a more detailed version you should include a project and explain your issue
This'll be interesting. I'm sure there are going to be a ton of library errors when you open this.
What I am looking at is....
Visualizations -> Maintenance -> Maint_InputAdjust
Functions -> TCCalTextVariable
The intended operation is that when an operator selects a value from the ComboBoxInteger (GVL.iTCSelect) on InputAdjust Screen, the "Text Variable" from all of those (24) Text Boxes needs to change based on the value of the combo box integer.
The way the case is written in TCCalTextVariable can sort of show better what needs to change.
I think I have a viable workaround for this.
I created 15 separate visualizations that have all of the text blocks linked to the exact variable that I need them on. For the main InputAdjust screen, I placed a frame with all 15 Visus in them and used "GVL.iTCSelect - 1" as the "Frame Switch Variable". Seems to be doing exactly what I need it to.
I edited the project a bit.
Not able to test it since I don't have a eurotherm environment available.
Log in to post a comment.