Showing results for 
Search instead for 
Did you mean: 

Lag When Using DAQ in Loops

I am working on a project which utilizes a c-DAQ with two NI-9485 DO, one NI-9215 AI and 1 NI-9264 as well as a few other modules. At specific times, the digital output activities triggering an external component while collecting data from the Analog input. Currently, I have it set up where there is a white loop inside of a for loop to use the elapsed time VI and at specific time intervals, it will trigger the digital output. During testing, I found that after every loop, it seems to buffer/lag, where it gets worse and worse.  I attached a small sample of how I have it set up (not the actual VI). After a loop is finished, it will add all the data into an array which is later exported to a spreadsheet after the full cycle is completed. Is there a solution to this?


For the analog inputs, I have it set up where its the two inputs into the 1 DAQ mx VI for a 1D, single sample for N-channels.

Additionally, is there a way to do this without the elapsed time which at x-y time, will trigger.



0 Kudos
Message 1 of 3

Forgot to add this, there is also a 1-2min delay when the loop finishes fully. Like the test finishes then it buffers for that time until I can actually do anything else, post test.

0 Kudos
Message 2 of 3

We cannot judge a vi from a truncated picture, but one huge red flag is the building of an evergrowing array in an uninitialized shift register. And poor coding in general!


For example when the inner loop is about to stop, you are appending data from a local variable that will only have new data once the loop has completed.

0 Kudos
Message 3 of 3