LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Exiting individual codes inside a loop sequentially

Solved!
Go to solution

I want to exit the individual codes inside the while loop depending on the one that reaches the comparison result first but dont know how to go about it.

Any help or pointer will be appreciated.

Tnx

 

0 Kudos
Message 1 of 9
(2,910 Views)

I honestly am not sure what you are asking. That having been said, perhaps occurrences are what you are looking for?

 

http://zone.ni.com/reference/en-XX/help/371361J-01/glang/occurrence_functions/

0 Kudos
Message 2 of 9
(2,900 Views)

Each filter is supposed to display the cutoff frequency when it has satisfied the requirements of the individual code. the less than and equal to function is supposed to stop the execution of that section of code while the next filter may still be running and also stops when the less than and equal to function gets a true value. But only one of the less than and equal to function can execute bc labview will not allow you connect the same function to the stop button.

Put these values in the user input section of the front panel and run the app, and see where i am going wrong.

TIMER: 5, START FREQ: 10.1, MAX FREQ: 6000, INCREMENT: 10, FILTER INPUT VOLTAGE: 5.

The cutoff frequency of the first filter comes up and the program stops executing. I want after the first cutoff frequency comes up, the second should also come up.

I need a clue how I can implement that

 

0 Kudos
Message 3 of 9
(2,888 Views)

Well, place each part into a case structure and execute the other (empty case) when the condition has been met.

0 Kudos
Message 4 of 9
(2,878 Views)
Hi Marco
I cannot see your code. It is missing the filter VIs. From what I understand you want the while loop to stop if one of the filters execute and find you a cut-off frequency, but at the same time you also want the other filter to report the cut-off frequency. Correct?
Why not have individual loops and make it parallel ?

@marco73 wrote:

Each filter is supposed to display the cutoff frequency when it has satisfied the requirements of the individual code. the less than and equal to function is supposed to stop the execution of that section of code while the next filter may still be running and also stops when the less than and equal to function gets a true value. But only one of the less than and equal to function can execute bc labview will not allow you connect the same function to the stop button.

Put these values in the user input section of the front panel and run the app, and see where i am going wrong.

TIMER: 5, START FREQ: 10.1, MAX FREQ: 6000, INCREMENT: 10, FILTER INPUT VOLTAGE: 5.

The cutoff frequency of the first filter comes up and the program stops executing. I want after the first cutoff frequency comes up, the second should also come up.

I need a clue how I can implement that

 


 


Kudos are the best way to say thanks 🙂
0 Kudos
Message 5 of 9
(2,873 Views)

Tnx All,

@Altenbach,

I dont seem to understand how you want me to achieve that, a code modification will be appreciated.

 

@SK8,

Initially I tried doing that but the dynamic data coming out of the tone measurement vi wasnt changing as it enters the loop containing the filters. the value of 10.1 remain constant, apparently my conversion from dynamic data wasnt working. I would also appreciate if u can put your thoughts in a modified vi. tnx

 

0 Kudos
Message 6 of 9
(2,868 Views)
Solution
Accepted by topic author marco73

marco73 wrote:

@Altenbach,

I dont seem to understand how you want me to achieve that, a code modification will be appreciated.


Here's a pretty dumb implementation. Ideally you should design the code as a proper state machine instead.

 

Basically, once each boolean is true, it will stay true and the code in the false case is no longer executed. Once all are true, the loop stops.

0 Kudos
Message 7 of 9
(2,860 Views)

Hi Altenbach,

Tnx for all your assistance.

I will read more on the state machine and see if i could implement it.

The solution you gave has done the job but from your suggestion, there is a more efficient method.

 

0 Kudos
Message 8 of 9
(2,849 Views)

This method is efficient, but it is not very scalable.

0 Kudos
Message 9 of 9
(2,844 Views)