01-30-2013 11:25 AM
Hello, how can I indicate that in the case structure one of the cases is executed..... if in the first case tructure (True) is executed, then the green indicator turns ON, when the execution is finished or (False) of this structure is executed or other case structure is executed indicator turns OFF...
respectively while true of the case structure is executed the indicator is ON...
Solved! Go to Solution.
01-30-2013 11:53 AM
Instead of a linear worm, use a state machine architecture. Show us some real code....
01-30-2013 12:05 PM
If I understand your example and question (which btw is not very clear at all)..try this.
Right click on the Measure2 bolean output and create a local variable of it.
Wire as many local variables to all the case outputs to as yopu wish to see it blink as the code executes.
To create copies of the local variable use ctrl+drag drop
Local vatriable is a copy of the original indicator. When the local ( or copy) gets changed LV automatically writes the change to the actual indicator. reading from the copy gives the value at the indicator.
You will hear a lot of very experienced programmers shun local and global variable ; I agree with this. Local variables are not recommended for serious programming
However, for simple stuff or to just see something work they can be helpful.
Remember though LabVIEW allows you to be absolutely terrible programmer and still get results, howbeit at the expense of many things. It is these things that will get back at you and bite you later on!
01-30-2013 11:15 PM - edited 01-30-2013 11:17 PM
Create local variable for all & inside loop make it true & outside make it false
01-31-2013 02:34 AM
I would be a total disservice to suggest to make horrible code even worse by peppering it with locals variables.
Again, please post your code and we we'll tell you how to do it the right way.
01-31-2013 05:58 AM - edited 01-31-2013 06:02 AM
Hello here is the code...
the first case structure Sets up an Agilent analizer, if button is pressed... during analizer setup process the indicator is turned ON
the second case structure carries out measurement(not implemented yet), if button is presed... during measurement process the indicator is turned ON
Any comments... for nonProgrammer???
01-31-2013 07:54 AM
You really should look into Event Structures. With LV8.6, I think you need the professional version to create/edit one. But the event structure can take care of each of those case structures and clean up those locals.
01-31-2013 03:10 PM
This code is way too rigid and peppered with race conditions. Is only one (initialize, measure) true at any given time, or can both be true?
"Latch until release" is not a very common mechanical action. Why did you pick it? (I would recommend "latch when released" instead)
Race conditions: For example, there is no data depedency between your writing true or false to the local variables, so the operation inside the case and outside the case occurs in parallel, and whatever writes last, wins. The operation is completely unpredictable!
01-31-2013 04:35 PM
Only one Measure or Initialize must occur at any given time...
Yes I've changed the button mechanical action... after few minutes of the VI test
That's true local variables are nit the best thing to do..
..... but still this code saves me a lot of time in measurements, but it should be rewritten in better manner
thank you for your efforts!!!
01-31-2013 05:29 PM - edited 01-31-2013 06:39 PM
Here's a quick draft that does not use any local variables. See if it makes sense.
(I did not really look at your subVI)