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
Analogue values on the screen
Re: Analogue values on the screen
Waldemar,
iX will only poll tags that are visible on the screen unless the "Always Active" box is checked. Try checking the "Always Active" box on the tag you are using.
Attached is a screen shot of where to set the number of decimal places.
iX will only poll tags that are visible on the screen unless the "Always Active" box is checked. Try checking the "Always Active" box on the tag you are using.
Attached is a screen shot of where to set the number of decimal places.
- Attachments
-
- decimalSetting.png (324.28 KiB) Viewed 10702 times
Best Regards,
Beijer Electronics, Inc.
Skylar Walker | Applications Engineer
Beijer Electronics, Inc.
Skylar Walker | Applications Engineer
Re: Analogue values on the screen
Thank You Skylar.
As I understood, there is no way to control the number of decimals, unless the value is shown in an analog numeric box?
regards, Waldemar
As I understood, there is no way to control the number of decimals, unless the value is shown in an analog numeric box?
regards, Waldemar
-
- Posts: 824
- Joined: Tue Mar 13, 2012 9:53 am
Re: Analogue values on the screen
Hi Waldemar,
You could always create your own on "Value Change Event" in the Tags scripting area and round the number.
You could always create your own on "Value Change Event" in the Tags scripting area and round the number.
Code: Select all
void Tag1_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
Globals.Tags.Tag1.Value = Math.Round((double) Globals.Tags.Tag1.Value, 1); //Returns 3.4.
}
Best Regards,
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Re: Analogue values on the screen
Works fine. Thank You very much Mark.