- 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 Task
for a step by step guide on how to use onboard counters to generate a sample clock, as well as example programs.
- 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>
- Analog Comparison Event (an analog trigger)
- 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
- 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.
- Use change detection to clock your digital task
- Use counter I/O instead of digital I/O
Pulse generations, frequency/period measurements can be done with using counters.
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
: 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.