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

Updated Nov 14, 2017

Reported In

Driver

  • NI-DAQmx

Issue Details

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?

Solution

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 are two example programs demonstrating how to use counters to generate a sample clock.
Example Program: M Series Correlated DIO with Counter Clock Generation in ANSI C
Example Program: M Series Hardware-Timed DIO with Counter Clock Generation

WAS THIS ARTICLE HELPFUL?

Not Helpful