I have a problem with my gauge digital display. While the gauge needle is at zero, the digital display is showing -6.
Is there any simple way to make the digital display minimum value to zero?
Interesting -- I thought this would be easy but it isn't.
Actually, I could not find a way to change the minimum on the digital display. My suggest would be check the input before and set it to 0 if it's less than 0. Anybody have any other ideas?
Thanks for replying.
Yes, it's true that my input is not zero but -6 but I thought there must be some way (property node or local variable) that I can set the minimium value
for the gauge digital display to zero without putting in additional comparator or selector.
I have attach my vi for your viewing. My labview version is 8.6. Pls advice if you can.
You may use the In Range and Coerce function.
Refer to the In Range and Coerce VI in the labview\examples\general\functions\Comparison directory for an example of using the In Range and Coerce function.
Yes, it's true that my input is not zero but -6
Ah. Mystery solved. There is a distinction between a gauge's needle display and its underlying value. The underlying value is by default a DBL, which means it can take on a value between (computer) -Inf and (computer) +Inf. It is no different than a regular numeric control that is a DBL. Thus, -6 is a perfectly acceptable value for the control to have. The needle display, however, has a different range. This is set by the "Scale" property. By default this has a range of 0 to 10. That is why you are seeing the needle say one thing while the digital display says something else.
The reason for this is that a gauge display is intended as a user interface control, and not really as an input to a VI. While it can be used as such, a programmer must consider what kind of value the control may receive. In this sense it is no different than any other control. As such, the question becomes: what is your program supposed to do if it receives an invalid input value (regardless of which input you're talking about)? As a programmer you basically have the following options: (a) accept the input as is, and let the code use the value as is (and not tell anybody); (b) coerce the value to a valid range (as suggested in the previous post) and continue with the coerced range (and not tell anybody); (c) generate an error and bypass execution of the VI.
Note that you can set the data range for the gauge display just like you can with a numeric control so that its minimum value is zero, but this has no effect if someone uses the subVI and wires in a -6. The built-in coercion only applies to a user entering a value directly on the front panel.
Hi t06afre and smercurio,
Thanks so much for the tips and detail explanation.
I did try using in range and coerce but that did not help. Finally, I just use greater than or equal to zero connect to a selector
with false value to zero. That did the job.
Appreciate your responses.
I did try using in range and coerce but that did not help.
What did you try, and what didn't work? This is a typical use of the In Range & Coerce: