Analogue values on the screen
Posted: Tue Mar 20, 2012 3:14 am
The task is to show an analogue value (e.g. pressure) on the screen. I wrote a script AnalogueValueScript.
Three tags were created
int Pressure_16bit;(to read value from a PLC register)
float Pressure_calculated; (used for further calculations)
string Pressure_text; (to be shown with comments on the screen)
The value of Pressure_calculated is taken from the script AnalogueValueScript, which is refreshing every 500mS from another script TimerScript:
Globals.Tags.Pressure_calculated.Value=Globals.AnalogueValueScript.Pressure();
Globals.Tags.Pressure_text.Value="Pressure= "+Globals.Pressure_calculated.Value.ToString()+" Bar";
Actually, it works, but only if I put the tag Pressure_16bit on the screen in an Analog Numeric control. Why? How can I avoid it?
Another question, too many decimals are shown on the screen. How to control their quantity?
Regards, Waldemar
Three tags were created
int Pressure_16bit;(to read value from a PLC register)
float Pressure_calculated; (used for further calculations)
string Pressure_text; (to be shown with comments on the screen)
The value of Pressure_calculated is taken from the script AnalogueValueScript, which is refreshing every 500mS from another script TimerScript:
Globals.Tags.Pressure_calculated.Value=Globals.AnalogueValueScript.Pressure();
Globals.Tags.Pressure_text.Value="Pressure= "+Globals.Pressure_calculated.Value.ToString()+" Bar";
Actually, it works, but only if I put the tag Pressure_16bit on the screen in an Analog Numeric control. Why? How can I avoid it?
Another question, too many decimals are shown on the screen. How to control their quantity?
Regards, Waldemar