Codesys HMI Display value

Hi all,

i want to ask a question. Can we display a certain information inside the textbox according to the sensor value ? If can, how can I do that ? For example, when the sensor value range is between 50-100, the textbox will display Low. Instead of showing the sensor’s value, I want it to show information according to the sensor’s range.


Best regards,

hii…there are various Methods…you can go with if_else, Case function or some standrad lib.

    SensorValue: REAL;
sDisplay: STRING(INT#10);

IF SensorValue<=0 THEN sDisplay:= ‘Empty’;
ELSIF SensorValue>0 AND SensorValue<=50 THEN sDisplay:= ‘Very Low’;
ELSIF SensorValue>50 AND SensorValue<=100 THEN sDisplay:= ‘Low’;
ELSIF SensorValue>100 AND SensorValue<=140 THEN sDisplay:= ‘High’;
ELSIF SensorValue>140 AND SensorValue<=180 THEN sDisplay:= ‘Very High’;

and use the “sDisplay” variable in HMI.


Thanks for your help, I finally managed to do! But another question, can the y-axis changed to alphabet too?