LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

samples and sampling rate for analog inputs

I am really confused with setting up daqmx tasks for 3 analog inputs (all differential voltages) and in general understanding the way samples are read , sampling rate etc. Also, can someone help me understand the various options for analog inpt read like single channel single sample, multi sample , multiple channel, multi sample, DBL, 2D waveform, 1D waveform etc etc.

 

I use USB 6008 and i get that for analog inputs we can acquire 10Ks/s per channel (Is this for single ended or differential or doesnt matter?)

For 2  channels, rate is 5Ks/s per channel and for 3 channels it is 3333 S/s. Now for 3 differential ended signals, is the sampling rate 3333 / 2 = 1667 S/s ?? Am I right here? I would really appreciate descriptive examples because I have done tonnes of reading and the wording at different places is confusing. Thanks! 🙂

I may not be perfect, but I'm all I got!
0 Kudos
Message 1 of 37
(6,928 Views)

Hey,

 

You will find some usefull information here -> Data Acquisition Sampling Terminology
Additionally read the Manuel for the USB 6008 and the Help for the DAQmxRead Options.

 

USB 6008 is using a Multiplexer to route the individual channels to a single ADC. So the 10kS/s are not per Channel, this is the maximum rate at which a single channel can be acquired.

This devides down with the number of channels you have in your channel list. 2 Channels = 5kS/s, and so on.

 

The sampling rate is independent of your Terminal Configuration (SE=Single Ended, RSE=Referenced Single Ended, Differential).

The terminal configuration depends on the signal source from which you want to acquire. For more information just have a look at the DAQmx Help.

 

Regarding the DAQmx Read:

- Single Channel, Single Sample = you acquire one sample from one channel, DBL

- Single Channel, Multiple Samples = you acquire multiple samples from one channel, 1D DBL or Waveform

....

 

Christian

 

0 Kudos
Message 2 of 37
(6,900 Views)

Hi Christian,

 

Thank you so much for your reply. I understand the sampling rate for a DAQ card's analog inputs now. I have one more question.

 

If we have say 3 analog channels acquiring voltage data. For max rate of 10KS/s, we get 3333 samples from each channel for each second. Now are the values arranged as 3 rows and n columns (n samples acquired), each row for each channel or are they arranged as a 1D array, each channel's voltage repeating  every three times??

 

Thanks!

I may not be perfect, but I'm all I got!
0 Kudos
Message 3 of 37
(6,862 Views)

Hi,

 

The Help for the DAQmxRead says:

 

data returns a 2D array of samples. Each row corresponds to a channel in the task. Each column corresponds to a sample from each channel. The order of the channels in the array corresponds to the order in which you add the channels to the task or to the order of the channels you specify with the Channels to Read property.

Christian

0 Kudos
Message 4 of 37
(6,850 Views)

Please find attached screen shot. Everytime I run this loop, It says "Attempted to read samples that are no longer available" error -200279.

 

Can someone explain how the values are read with respect to the sample rate I have set, loop delay at 100ms and how the buffer runs out of samples. I can't picture what going on in the buffer with all these multiple parameter settings. Thanks!

 

VJ

 

(I get 1500 sample rate means 1500 samples per second -> 500 samples for each channel in one second. now, loop rate 100ms, means each iteration 9 samples are read in one second, 9 x 10 = 90 samples out of 1500 are read. In the next second, There are 1500 more samples to read correct? Then why are we running out of samples to read?

 

 

I may not be perfect, but I'm all I got!
0 Kudos
Message 5 of 37
(6,780 Views)

You aren't running out of samples. That is not what the message says. You aren't reading enough. The simple fix would be to just change to finite samples

0 Kudos
Message 6 of 37
(6,761 Views)

(I get 1500 sample rate means 1500 samples per second -> 500 samples for each channel in one second. now, loop rate 100ms, means each iteration 9 samples are read in one second, 9 x 10 = 90 samples out of 1500 are read. In the next second, There are 1500 more samples to read correct? Then why are we running out of samples to read?

 

 

Is this logic correct?

I may not be perfect, but I'm all I got!
0 Kudos
Message 7 of 37
(6,699 Views)

You are not running out of samples to read, the buffer on your DAQ hardware is getting filled up with too many samples and the buffer has limited memory. When you fill it up with too much data, the oldest values get thrown away and are no longer available to be read. This is why the error is saying, "Attempted to read samples that are no longer available." It is throwing that error because you are telling the card that you want to be able to read a continuous acquisition. This means that there cannot be any lost data in your acquisition and if there is it will throw errors. This is why it was recommended to change the acquisition mode from continuous to finite acquisition.

National Instruments
Applications Engineer
0 Kudos
Message 8 of 37
(6,673 Views)

Finite acquisition does not solve problem. USing Finite samples, I get error -200278 "Attempted to read a sample beyond the final sample acquired. The acquisition has stopped. yada yada yada. "

 

Using sample rate 3000 and samples to read 500.

 

V

I may not be perfect, but I'm all I got!
0 Kudos
Message 9 of 37
(6,577 Views)

My program has to run as long as needed without the error "attempted to read samples that do not exist". This happens when I leave the program running for as long as 5 minutes. And finite samples is not working.

 

What is the right combination of sample rate and samples to read that is needed to overcome this problem. Or is there to increase the size of the buffer to a size that would not possibly fill up?

 

VJ

I may not be perfect, but I'm all I got!
0 Kudos
Message 10 of 37
(6,554 Views)