Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital IO input and output simultaneously

Hi all,

 

I have a cDAQ-9172, and I am working with the NI 9401 module, which is a digital IO.  I am using counter 1 and 2 as input (bit 0 and 4), bit 3 as a general input, and bit 7 and 8 as general output.  As you can see, I have to switch bit 4-7 between input and output during the program.  I would start the input task, and when I am done, I will end it.  After that I will start the output task and end it.

 

However, I am getting the error that I can't use a port setup as output for an input operation.  How do I get a bit in a module to work as input and output at different time of the execution?  Thanks!

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 3
(3,355 Views)

You can't change the line direction on the NI 9401 while a line on the module is in use by another task.  The 9401 is also nibble configurable.  Lines 0-3 and 4-7 need to be the same direction.  See this thread for more details.

 

You can configure your input tasks to only use lines 0-3 and have lines 4-7 be for output.  You should reserve the direction, as specified in the linked thread, before starting any tasks.  Alternatively, if you would rather start your output after the input has finished, you can stop all tasks on the module and then configure the necessary lines for output.

0 Kudos
Message 2 of 3
(3,350 Views)

Hi jyang,

 

Here's a great resource for the bidirectional nibble configuration of an NI 9401 with DAQmx.

 

KnowledgeBase: Why Do I Get Error 201133 When Trying To Perform Bidirectional DI/O with My NI 9401 i...

 

Be sure to check out the community examples linked in the KB.  I hope this helps!

 

- Greg J
0 Kudos
Message 3 of 3
(3,137 Views)