This content is not available in your preferred language.
The content is shown in another available language. Your browser may include features that can help translate the text.
Why and how do I have to specify a number of samples to read when continuously acquiring data using NI-DAQmx with support for LabVIEW?
The size of the array/waveform, as well as the size of the DAQmx PC Buffer, are implicitly determined by the configuration of the DAQmx task, as outlined below.When performing an acquisition with DAQmx, data is first transferred from the DAQ Device into the memory (RAM) of your computer. There is a a preallocated buffer on your computer's RAM, called the DAQmx PC Buffer, which is reserved as a holding place for unread data. Data can then be read from the DAQmx PC Buffer and into an array or waveform inside of your DAQmx application by executing the DAQmx Read function.
When you configure the DAQmx Timing VI for your task in LabVIEW, the Samples per Channel value has a different effect depending on whether the Sample Mode is set to Continuous Samples or Finite Samples.
Conversely, DAQmx Read has an input called Number of Samples per Channel. The Number of Samples per Channel value determines the size, in samples, of each array or waveform of data that is read from the buffer into your application when DAQmx Read is executed.
It should be noted that DAQmx Read will wait until all of the requested samples have been acquired and stored in the DAQmx PC Buffer before providing the data to the application.Consequently, if the sampling rate is not fast enough to create an array or waveform of this size in the time allotted by the timeout, the VI will throw a timeout error. To prevent this, increase the timeout parameter (the default value is 10 seconds), or reduce Number of Samples per Channel.
Note: The transfer speed between the DAQ device and the DAQmx PC Buffer on the host computer's RAM depends on the bus being used to communicate with the DAQ Device (PCI, USB, PXI, etc.).In the interactive DAQ Assistant panel, as well as in SignalExpress and NI MAX, this parameter is renamed Samples to Read, as shown below:
The default value for Number of Samples per Channel is -1, which causes DAQmx Read to read all data that is available in the buffer immediately. If no data is available in the buffer when Number of Samples per Channel is set to -1, DAQmx Read will return an empty array rather than wait for samples to be acquired.
Thank you for your feedback.
You changed your response to Not Helpful
You changed your response to Helpful
Collaborate with other users in our discussion forums
A valid service agreement may be required, and support options vary by country.