Options for Hardware-Timed Digital I/O on M Series DAQ Device

Updated Nov 23, 2017

Reported In

Driver

  • NI-DAQmx

Issue Details

I am using an M Series Multifunction (Data Acquisition) DAQ device to acquire or generate digital signals. I know that my device does not have an onboard timing engine for digital I/O. Therefore, I will have to use some other clock source to time the digital I/O on my M Series device.

What options do I have for hardware timed digital I/O?

Solution

  1. Use one of the onboard counters to generate a sample clock for your task
Refer to How to Use Counters To Generate a Sample Clock For a DAQmx Digital Taskfor a step by step guide on how to use onboard counters to generate a sample clock, as well as example programs.
  1. Use an external sample clock for your task
To do this, you will need to have an external clock signal available that can be used to time your digital I/O task.  The external clock signal can be connected to any of the following external pins: 
  • PFI <0..15>
  • RTSI <0..7>
  • PXI_STAR
  • Analog Comparison Event (an analog trigger)
  1. Use the analog input sample clock, analog input convert clock, or the analog ouput sample clock as the sample clock for your digital task
This is a good option if you want to synchronize analog I/O and digital I/O. This option also works well if you do not need to use either the analog input or the analog output on your device. Keep in mind that if you use this option you must clock your digital I/O at the same rate as either your analog input or analog output (depending on which clock you use). 
To use the analog input sample clock, analog input convert clock, or the analog output sample clock to time your digital task, refer to How to Use Sample Clocks of Analog I/O Tasks to Time Digital Tasks in DAQmx
  1. Use the device's onboard frequency generator to provide a sample clock for your digital task
Please refer to Using the Onboard Frequency Generator For Hardware-Timed Digital Tasks on M-Series DAQ Device for detailed procedures and example programs.
  1. Use change detection to clock your digital task
More details on change detection, as well as Example Programs are included in the Additional Information section.
 
  1. Use counter I/O instead of digital I/O 
Pulse generations, frequency/period measurements can be done with using counters. For more information, refer to the following resources:
Example Program: NI-DAQmx: Continuously Measure Counter Frequency (Buffered-Large Range)
Example Program: Measure High Frequency 2 Counter Method
 

Additional Information

Change detection is a digital operation in which a transition on one or more digital input lines causes the entire group or port to be captured in hardware. Change detection is a strobbed operation, meaning that transfers are controlled by hardware (clock signal or handshaking lines). Once a change occurs, data is latched into a hardware buffer, and then the pattern is transferred via Direct Memory Access (DMA) or Interrupt to the PC memory. Change detection can quickly identify changes in digital port state and allows port monitoring without polling in a software loop. It also removes redundant data and registers for the entire port. Change detection is covered on page 6-8 of the M Series User Manual. For more information, refer to the following resources:

White Paper: Digital Change Detection in NI-DAQmx 
Example Program: NI-DAQmx Events: M Series Change Detection

Note: Do not exceed the digital I/O Sample Clock Frequency given in the specifications for your device. This is the maximum clock speed allowed regardless of the clock source. Doing so will not cause a software error, but it may result in under-sampled data.

WAS THIS ARTICLE HELPFUL?

Not Helpful