How To Use Counters To Generate a Sample Clock For a DAQmx Digital I/O Task

Updated Oct 5, 2022



  • NI-DAQmx

My M-Series Data Acquisition (DAQ) device does not have an onboard timing engine for digital I/O. 
How do I use the onboard counters on one of my DAQ device to generate a sample clock for my DAQmx Digital Task?

To do this, you will need to complete the following steps:
  1. Create a counter output task that will generate a digital pulse train at the desired clock frequency for the digital input or digital output task.
  2. Create a digital input task or digital output task and specify the source for the sample clock as the internal counter output of the counter that is configured to generate a pulse train.
  3. Start the digital input or digital output task.
  4. Start the counter task when you are ready for the digital task to start acquiring or generating.

Additional Information

Here is an example program demonstrating how to use counters to generate a sample clock.
Example Program: M Series Hardware-Timed DIO with Counter Clock Generation