Is There a Example on the NI 9401 that Enables Synchronized DIO Based on an External Clock?

Updated Apr 17, 2023

Reported In

Hardware

  • NI-9401

Software

  • LabVIEW

Driver

  • NI-DAQmx

Issue Details

I want to use NI 9401 to generate signals from digital outputs and to measure signals using digital inputs. At this point, the digital output and input must be synchronized. And I'd like to use an external clock source for the sample clock. Is there an example I can refer to to do this?

Solution

The shipping example provided by NI does not include a synchronized DIO example that uses the external sample clock you want. However, the functionality you want is similar to the Multi-Function-Sync Dig Read Write With Counter.vi example, so you can implement it with a few modifications. This example is included in Legacy NI-DAQmx Shipping Examples and is located in a folder named Synchronize Digital Input and Output Channels using a Counter as a Clock. The following code performs a synchronized DIO based on an external sample clock that has been modified based on the Multi-Function-Sync Dig Read Write With Counter.vi.



Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

 

Additional Information

To perform digital outputs and inputs with the NI 9401, you must add a task to your code called Task Scheduling. Refer to Error -201133 with NI 9401 in NI-DAQmx When Running Multiple Digital I / O or Counter Tasks in the Related Links section for details.