12-01-2023 04:29 AM
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
12-01-2023 04:59 AM
Like so?
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...
12-01-2023 06:00 AM - edited 12-01-2023 06:06 AM
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?
12-01-2023 06:35 AM - edited 12-01-2023 07:00 AM
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 )
12-01-2023 12:50 PM - edited 12-01-2023 01:11 PM
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:
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.