LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to indicate that the loop is in progress

Solved!
Go to solution

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...

 

 

 

 

Untitled.png

0 Kudos
Message 1 of 14
(3,888 Views)

Instead of a linear worm, use a state machine architecture. Show us some real code....

Message 2 of 14
(3,880 Views)

 

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!

 

 

 

 

 

 

0 Kudos
Message 3 of 14
(3,877 Views)

Create local variable for all & inside loop make it true & outside make it false

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
Message 4 of 14
(3,843 Views)

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.

0 Kudos
Message 5 of 14
(3,825 Views)

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???

Download All
0 Kudos
Message 6 of 14
(3,804 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 14
(3,784 Views)

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!

Message 8 of 14
(3,751 Views)

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!!!

0 Kudos
Message 9 of 14
(3,726 Views)
Solution
Accepted by topic author ku_ku

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)

 

 

 

 

0 Kudos
Message 10 of 14
(3,715 Views)