Codesys Visualization - Text Field multiple variables?

theColonel26

Lifetime Supporting Member
Join Date
Feb 2014
Location
West Michigan
Posts
785
Is there any way to bind more than one variable to a Text field?

I want to be able to doing something like this
<Value> <Unit>


104.6 F
or
56.14 PSI

etc.


Then further, to be able to specify the the format of the Value (decimal places etc)

I assume no?

Is the only way to do this to concat a string in a PRG?
 
What I have done in the past is a selectable text field for the type of Units using a bit i.e. Deg. C or Deg. F then the value is set to 2 decimal places (some platforms can use another field for decimal places but not all) then use the units toggle bit to move the two values into the field so for example:
AND My toggle bit move Var Deg_C to HMI_Field
AND NOT Toggle bit move Var Deg_F to HMI_Field
The units is just a fixed field that displays one of two texts depending on the toggle bit.
On Beijers HMI's I have also used a text field with multiple text lists & the variable that selects them is a integer so depending on the value of the variable it displays the text i.e.
0 Message 1
1 Message 2
3 Message 3
& so on.
 
I know it only half answers your question, but you can do something like. The below picture. Maybe you want to create your own Function PrettyUnitFormatter(Value:LREAL,Unit:STRING,ValueFormat:STRING)

2021-11-04_09-54-46.png
 
Last edited:
I know it only half answers your question, but you can do something like. The below picture. Maybe you want to create your own Function PrettyUnitFormatter(Value:LREAL,Unit:STRING,ValueFormat:STRING)
Oh sweet !!! I didn't know I could call a function in there


I tried to bind it to a FB.property but it threw an error saying I couldn't call ADR on the assigned variable.

I will try a function.
 
Last edited:
Works you win the internet




HOWEVER is a String formatting function for REALs built in to codesys?

or am I going to have to build something to specify 0 padding and decimal padding?
 
It should be installed in your system already. Double click library manager, Click add library, press the button on the far right labelled 'Display advanced libraries', type the function name into the search box, wait impatiently for 10 seconds, then select one of the entries for Library "StringUtils"
 
It should be installed in your system already. Double click library manager, Click add library, press the button on the far right labelled 'Display advanced libraries', type the function name into the search box, wait impatiently for 10 seconds, then select one of the entries for Library "StringUtils"
Sweet I found it

Clicking the advanced button is what i was missing I think.
 

Similar Topics

I dont see image in Codesys Visualization Lamp or Switch .
Replies
0
Views
1,345
Im Looking for a way in codesys visualization to rotate an image based on a variable. I know the polygon is the only object that allows rotation...
Replies
1
Views
5,011
hello all, i have done visualization to have a model of elevators(auto car parking)....now i want to program it in such a way that when i enter...
Replies
5
Views
3,044
what are the steps for recipe management in visualization scada of codesys in ABB plc ??
Replies
1
Views
2,468
Does any1 knows the steps for recipe management in visualization scada of ABB codesys plc ??
Replies
3
Views
3,485
Back
Top Bottom