Example Programs

Showing results for 
Search instead for 
Did you mean: 

Change DAQmx Sampling Rate While Continuously Acquiring Data


This example shows how to change the sampling rate while acquiring data.



The sample rate is initialized at 1000 Hz.  In order to change the sampling rate while acquiring data, the task must be stopped, the sample clock must be reconfigured and then the task must run again. This VI achieves this through the advent of an event structure which performs this every time that the rate control experiences a value change.  After a timeout of 10ms, data is acquired continuously at this new sample rate, until another value change occurs at the rate control.




  • LabVIEW 2012 or compatible
  • NI-DAQmx 9.5.5 or compatible


  • NI Multifunction DAQ Device


Steps to Implement or Execute Code

  1. Configure the parameter for the right channel and device
  2. Connect your hardware appropriately
  3. Run the VI
  4. Chang the sample rate.
  5. Check the result.


Additional Information or References

The following image displays the event that occurs when a value change occurs on the rate control:

搜狗截图17年01月21日1750_5.png The following image displays the event that occurs when no value change occurs on the rate control:


 **This document has been updated to meet the current required format for the NI Code Exchange.**


Sara Lewandroski
Applications Engineer | National Instruments
Member lukin.21

Is possible to do this without interrupting acquisition? Like use external sample clock on M series board? I try change AI sampling rate on the fly using external sample clock but it didnt work well thanks. :-)

Member lgx

how about the time between stop and restart,

do I know if the interval of timing between the last point of fast sampled data and the first point of slow sampled data?




from what I understand, the time stamp it the timing when computer read in the data. 

I am using USB-6002.

Member danielruetimann

Do you have any example on how to do this (change sampling rate) in C#? Thanks.