DAQ Device is Not Sampling at Specified Rate in LabVIEW

Updated Feb 5, 2024

Reported In

Software

  • LabVIEW
  • LabVIEW NXG

Driver

  • NI-DAQmx

Issue Details

I have a DAQ device using DAQmx. I specify a sample rate, but when I run my VI, the device samples at a slightly different rate. I have noticed that some frequencies work better than others. Why is this? What frequency should I expect from my device?

Solution

The following describes the general approaches on how to calculate the expected sample rate:

For Analog Input tasks:
  1. X = Sample Clock Timebase / Specified Sample Rate
  2. Round X down to the next integer value.
  3. Actual Sample Clock = Sample Clock Timebase / X


For example,

  1. 20 MHz / 17545 Hz = 1139.93
  2. 1139.93 rounded down is 1139.
  3. 20MHz / 1139 = 17559.26 Hz

Thus, 17559.26 Hz is the actual sample clock rate for the analog input task.
 

For Analog Output tasks and Digital I/O:

  1. X = Sample Clock Timebase / Specified Sample Rate
  2. Round X to the nearest integer value (up or down).
  3. Actual Sample Clock = Sample Clock Timebase / X


So, for the example given:

  1. 20 MHz / 17545 Hz = 1139.93
  2. 1139.93 is rounded up to 1140.
  3. 20 MHz / 1140 = 17543.86 Hz

Thus, 17543.86 is the actual sample rate for the analog output or digital task

Additional Information

Programmatic Access in LabVIEW:

You can read the actual sample rate used through DAQmx Timing Property Nodes by selecting Sample Clock » Rate. Below is an example of this in LabVIEW:
 


Figure 1:  Using a DAQmx Timing Property Node to Read Coerced Sample Rate




Note:  Some NI DAQ devices use delta-sigma analog-to-digital converters (ADCs) to acquire at higher resolution than other devices. These DAQ devices may have additional limitations on their sample rates aside from those outlined above. These limitations can be found in the user manual/specifications sheets for your hardware, refer to Valid Sampling Rates for NI DSA Devices  for an overview.