LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB 6009 and TDMS write

Dear all!

 

I'm using USB-6009 device to adquire data from a physical channel. In the following vi, the number of samples to be adquired is set to 1000, with a 100Hz rate. Therefore, as I understand, the number of samples that should be read inside the while loop where DAQmx read is placed should be 10 for each iteration. However, I've tried to store this information in a TDMS file and I'm getting less number of samples as expected. I wouldn't like to lose any data.

 

I've read overthere that the USB-6009 is a software-timed device, so, can this be the reason of this anomaly? Moreover, if I analyze the adquired samples using DIAdem software, I see some samples are being repeated. In this case, am I overwriting some data and reading past values?

 

 

If I need to replace my data adquisition device with a hardware-timed one, which one should I get?

 

Thank you very much in advance,

 

Miren  

0 Kudos
Message 1 of 4
(2,917 Views)

When you run the sample clock in  "Continuous Samples" mode, the # of samples only determines the buffer size.  This is outlined in the help for that function.

 

As a result, you have nothing pacing the internal loop: If there are samples available when it reaches the DAQmx Read, it passes out as many as are available in the buffer.  You might get 1, 2, 100; it depends on how long the other operations in the loop take.

 

In general, DAQmx loops like this can be paced either by time or by # of samples.  Looks like you want sample pacing: wire the number of samples you want to collect to the "# of samples per channel" input of the DAQmx read.  Then the loop will wait at the daqmx read until that many samples are ready, and then it will proceed.

-Barrett
CLD
0 Kudos
Message 2 of 4
(2,900 Views)

Thank you very much for your answer. Therefore, in any of the cases, pacing the loop with samples or time in the one hand and with nothing pacing the loop on the other hand, I would not lose any information?

 

About the other question I was making, why am I getting samples with the same value when i look through the data in DIAdem? 

 

Miren

0 Kudos
Message 3 of 4
(2,892 Views)

-Losing samples should only happen if the buffer overflows.  If the other operations in the acquire loop happen too slowly, the buffer can fill up.  One way to avoid this is to put the logging in its own loop, search for examples of "Producer / Consumer Architecture".

 

I'm not entirely sure here, but I would guess that you get duplicate values when the loop iterates faster than the sample rate, and the buffer is empty when DAQmx read executes; either DAQmx read is returning the last measurement or TDMS write is writing a default value.

 

 

-Barrett
CLD
0 Kudos
Message 4 of 4
(2,879 Views)