05-01-2009 09:30 AM
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
05-01-2009 11:07 AM
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.
06-17-2010 09:39 AM
Hi jyang,
Here's a great resource for the bidirectional nibble configuration of an NI 9401 with DAQmx.
Be sure to check out the community examples linked in the KB. I hope this helps!
- Greg J