How to Dynamically Change the Sampling Rate in DAQ Assistant?

Updated Apr 12, 2023

Environment

Software

  • LabVIEW Base

Driver

  • NI-DAQmx

I am using the DAQ Assistant Express VI inside of a while loop to acquire a distinct set of finite samples for each iteration of the loop. I would like to change the sampling rate of the DAQ Assistant for each while loop iteration, how can I accomplish this?

Since the DAQ Assistant does not stop the task it creates until a true is wired into the stop terminal, the task must be stopped to change properties such as the sampling rate. You can use the DAQmx VIs to stop the task, and then change the sampling rate. The DAQ Assistant will restart the task automatically.

This can also be accomplished by using the DAQmx driver VIs exclusively. Numerous DAQmx example programs are available in LabVIEW under Help >> Find Examples >>Hardware and Software >> DAQmx to help get started programming with DAQmx.
 

Additional Information

If you are trying to use this example code for a continuous acquisition, data points will be lost in between iterations of the while loop.