LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional start of while loop with DAQ card

Hi,

I want to enter into a while loop based on an analog trigger voltage that I define. How can this be done. More generally can a while loop be "conditionally started"?

Any help would be much apprecaited.

Mike

0 Kudos
Message 1 of 5
(415 Views)

Like so?

LLindenbauer_0-1701428145468.png

 

It looks like you are trying to achieve something that could be solved by making proper use of DAQmx. Maybe you would like to take a look at this article: https://www.ni.com/en/support/documentation/supplemental/06/learn-10-functions-in-ni-daqmx-and-handl...

0 Kudos
Message 2 of 5
(399 Views)

Thank you Llindenbauer.

 

I dont suppose you could upload the VI please? It looks to me like the while loop will stop when the condition is met, whereas I would like to actually begin when that condition is met. Perhaps I am wrong?

 

0 Kudos
Message 3 of 5
(379 Views)

The second loop will start when the first loop is stopped. That happens when the trigger point is reached, which comes close to what you describe. Did you at least take a glance at the article I linked? Can you describe in more general terms what your data acquisition setup and task looks like?

 

I already deleted the sketch above and I'm certain that it would not even help you. If you find it hard to replicate the code in the image, I recommend looking into LabVIEW tutorials (e.g. https://learn.ni.com/courses/exploring-while-loops )

0 Kudos
Message 4 of 5
(362 Views)

Typically you only have one toplevel loop and a state machine architecture. When the condition is reached, go to a different state (i.e. different case of an case structure).

 

Here's a simple example:

 

altenbach_0-1701456617766.png

 

With your "downhill worm code architecture" there is a lot of duplicate code and you can never go back to the beginning. You can easily keep iteration counters for the various states in an array of integers held in a shift register, for example.

 

 

0 Kudos
Message 5 of 5
(338 Views)