LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Wrote SubVI to validate inputs. Need to only warn for certain value ranges (which makes the value stay out of range), but how can I warn only once?

There are four limits for this subVI. For extreme high or low limits I force a normal limit value - easy! But, if the value is not normal and still inside of extreme limits, then I just issue a warning and give the user the option to keep their value.

The problem is that when I place this subVI into the program (which is in a while loop) then it will warn to user over and over, until the value is changed. I would like to only warn the user once, and if they decide to leave it then only warn them when the value is changed again and still not normal.

Is there a function in LabVIEW (6i) to do something like, "u
pon some change then run this code once," or something that will limit the number of warnings.

It seems like there should be a way, but I'm just starting with LabVIEW and haven't learned enough. I've usually been able to find answers from other postings, but couldn't find this one. Any help is great!
0 Kudos
Message 1 of 3
(2,104 Views)
A fairly simple solution would be to put the code to be executed once into a case statement (inside an overall while loop). Wire the case statement to a boolean control, so that the code only executes when the case is true. Now, when the program is run, make sure the boolean is initialized to true. This should guarantee that the code runs the first time. Inside of the case statement(in the true case next to the code vi) use a local variable of the boolean to set the boolean to false. The code should not run again. Now you can monitor the value for changes, and when it changes, use another local to set the boolean to true.

Long winded, eh? Hope it helps. Whipped up a quick and ugly demo for 6i.
Message 2 of 3
(2,104 Views)
Thanks! I really appreciate your help.
0 Kudos
Message 3 of 3
(2,104 Views)