How to Use Sample Clocks of Analog I/O Tasks to Time Digital I/O Tasks in DAQmx

Updated Oct 5, 2022



  • NI-DAQmx

I have a M-Series Data Acquisition (DAQ) device which does not support hardware timed digital I/O tasks. How can I use sample clocks of other DAQmx analog tasks to time digital I/O tasks?

Here are the steps you must complete to use the analog input sample clock, analog input convert clock, or the analog output sample clock to time your digital task. This method is also a good option if you want to synchronize analog I/O and digital I/O tasks.
  1. Configure an analog input task or analog output task. Set up the timing such that the analog task's clock will run at the rate desired for your digital I/O task. Even if you do not want to perform any analog I/O, you still must configure this task as a "dummy task".
  2. Configure a digital input or digital output task. Specify the source for the sample clock as either /<NI-DAQmx Device Name>/ai/SampleClock, /<NI-DAQmx Device Name>/ai/ConvertClock, or /<NI-DAQmx Device Name>/ao/SampleClock.
  3. Start the digital input or digital output task.
  4. Start the analog input or analog output task. Starting the analog task will start the sample clock for your digital task.

Additional Information

Here are two examples demonstrating this concept:
Example Program: M Series: Correlated Digital Output with Analog Output Sample Clock
Example Program: Performing Correlated Digital IO with an M Series Device in LabVIEW