From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx logging only picks data of last second...

Solved!
Go to solution

Hello,

 

I am working on a VI to measure a voltage signal with a DAQ USB-6361 (sample rate 150 kHz) and store the data (see attached VI). I had to use DAQmx functions because of data loss problems and therefore the DAQmx logging function is used for data storage.

I added a "timing function" to set a specific starting time and measurement duration. Since I did that the program only stores the last second (150000 data points) although the number of total samples acquired increases according to measurement duration while the program runs.

I've been staring at my VI for quite some time now but I can't figure out why it's not storing data correctly any more. Can anyone give me a hint of what's my VI's problem?

0 Kudos
Message 1 of 5
(2,882 Views)

Hard to know since we don't know what settings you are putting in your time controls on the front panel.

 

My guess is that your inner while loop only runs for a second.  It ends, the outer while loop iterates again, and your Logging to DAQ is set to  Create or Replace which means it is overwriting the previous file.

 

Try Open or Create.  Then sort out if your time stamp logic makes sense since you are combining some user entered values of start time and end time and comparing to the PC-derived value of time.

0 Kudos
Message 2 of 5
(2,877 Views)
Solution
Accepted by topic author Aliom

There should be a wait in your outer loop to slow it down while check for timing conditions.  Also there may be a conflict in your timeout checks.  If the timeout happens to be 0 when it checks it could run the inner loop once and stop the outer loop, hence your once sample issue.

 

Also I would suggest changing your channel setup so that your set things up only once instead of slowing down your read loop every time you activate it.  You really don't need to start and stop your task each time.  That can be done at the start and stop of your program.  Unless you anticipate settings changing.

 

I assume you are using LV2012.  The attached should be LV2012.

0 Kudos
Message 3 of 5
(2,860 Views)

Thank you so much! Now it's working as it should...just one tiny change to your modified VI: the while-loop shouldn't be connected to the error output of the case-loop. Otherwise the starting time function doesn't work anymore...

Have a nice weekend

 

0 Kudos
Message 4 of 5
(2,826 Views)

I meant to unbundle the error status and put a logic not on the input the AND gate.  This way your outer loop stops right away if there is an error instead of waiting for a timeout.  I just got in a hurry.

0 Kudos
Message 5 of 5
(2,804 Views)