Example Programs

Showing results for 
Search instead for 
Did you mean: 

Configuring an NI 9401 for Bidirectional DIO By Nibble with DAQmx


This example demonstrates how to properly configure an NI 9401 in DAQmx for independently controlled bidirectional DI/O with nibble 0 (lines 0-3) set for digital input and nibble 1 (lines 4-7) set for digital output.


This VI creates a digital input (DI) and digital output (DO) task which will perform continuous bidirectional data acquistion.



  • NI LabVIEW 2009 or compatible
  • NI DAQmx 8.9.5 or compatible


  • NI 9401 DIO Module
  • NI CompactDAQ Chassis

Steps to Implement or Execute Code

To run this example, select the proper I/O channels for each nibble corresponding to DI and DO, set the execution timing for each nibble independently, and run the VI.

This VI:

1. Creates DI and DO tasks
2. Reserves one of the tasks first
3. Starts the other task that has not yet been reserved
4. Starts the task that was previously reserved
5. Performs continuous bidirectional DIO
6. * Note that each nibble can execute at different rates
7. Clears tasks and handles errors



Additional Information or References

One way to easily observe the bidirectional capability is to perform a loopback test across the nibbles (i.e. connect line 0 to line 4, line 1 to line 5, and so on).  Then when you run this VI, you should see your output reflected on the input indicators.

See Nibble DI/O Configuration for Triggering with NI 9401 for an example of this configuration used to trigger an analog task.

**This document has been updated to meet the current required format for the NI Code Exchange.**

Member pollon

Can you please convert to labview 8.6? thank you

Member MarkMoss

I just ran into this "must reserve the task first" issue in one of my programs.  Does anybody know why this is required when using the 9401, and not for most other boards/modules?

In my program, I don't have much control over which task is configured or started first (user configurable).  It looks like if you reserve each task as you create it, you can create or start the tasks in any order.  Some understanding of why this is needed for the 9401 and not other modules would give me more confidence that this isn't going to cause an issue for me somewhere else...

Member ryanpkc

Can you please explain how to build this VI?

Member philip.timson

Great example.  You just saved me a bunch of time!