03-22-2024 08:33 PM
Hi all,
I have a DAQmx task that I would like to be able to start and stop as needed without having to stop the entire VI... Essentially, I want to be able to start/stop the DAQ (to reduce memory load etc) when I need to examine the acquired data and get various values etc... I could simply stop the data going to the chart while I zoom-in and examine the data etc, but it seems inefficient to keep the DAQ reading data in the background for no reason when I do this... I have tried using a single while loop with a case structure to remove/hide the DAQmx read vi, but I get buffer errors as the task is still running and the buffer runs out of memory...
I understand the DAQmx start and stop vis should be placed outside the while loop to improve performance; hence the idea of switching between nested while loops... I have attached my initial attempt using simple loop timers to determine the functionally... However, this is not working as desired...
Any suggestions would be much appreciated...
Thanks...
03-22-2024 09:02 PM
Hi all, I have made some changes and now have it working... Note I have multiple parallel loops and the outer loop is stopped via a button in another loop through the queue...
Any comments on this are appreciated... Thanks...
03-22-2024 09:48 PM
What you posted looks extremely fragile.
A few suggestions:
03-22-2024 10:07 PM
I would recommend Using a Queued Message Handler in LabVIEW
03-25-2024 09:25 PM
Thanks... I will make the revisions you are suggesting...
When you say to initialise the DAQmx Start outside the loop, do you mean outside the inner loop (so the DAQ task will initialise one time only on the first iteration of the inner loop )? Or outside the outer loop (so the DAQ task is initialised once only when the vi first runs)?
03-25-2024 09:28 PM
Thanks... How could a "pause" case to stop the DAQ read be done? Would the DAQ need to be stopped and reinitialised before reading again?
03-25-2024 09:49 PM
I made a quick mode of an included example before I go to sleep, snippet below and 2021 version attached.