Example Code

M Series Hardware-Timed DIO with Counter Clock Generation

Code and Documents


VI Description:

This VI shows how to use an onboard counter to generate a sample clock for use with hardware-timed (aka "correlated") DIO on port 0 of an M Series MIO NI-DAQ card. No external connections are necessary.

Block Diagram Steps:

1. Create a Counter Output pulse train channel to provide the clock signal

2. Create a Digital Input channel on port 0 of any M Series DAQ device.

3. Configure pulse train duration to correspond with number of samples requested for Digital Input operation.

4. Start the Digital Input task FIRST, then begin clock generation by starting the Counter Output task.

5. Return all samples to a waveform chart and clear both tasks before checking for any errors.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.