Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I configure the cDAQ NI 9401 for digital input AND output?

It is stated that the cDAQ NI 9401 can be set to digital input and digital output, that is "nibble wise".
I would like to use ctr0 for frequency measurements and BIT7 for digital out.
 
I would expect this requires a configuration where I have to set the low 4 bits to input and the high 4 bits to output.
However, I am not able to find where to set this configuration.
In MAX' test panel, it is possible to configure input and output bits. However, here the configuration can not be set permanently.
 
Any ideas?


Message Edited by donkdonk on 02-28-2008 08:20 PM
0 Kudos
Message 1 of 7
(8,587 Views)
The NI 9401 is nibble configurable but it cannot be reconfigured while in use.  This means if you have a task running on lines 0:3, you cannot reconfigure lines 4:7 until you stop and unreserve all lines. 

To configure the 9401 for both input and output, create your input and output tasks.  Then, before you start either task, reserve both tasks.  In Labview this is under  DAQmx Advanced Task Options->DAQmx Control Task.  Set the Action to reserve.  In the C API, this is DAQmxTaskControl (taskHandle, DAQmx_Val_Task_Reserve).

After both tasks have been reserved, you can start your tasks.  You could also reserve task1, start task2, and then start task1.

Since this is an advanced feature of DAQmx, you cannot configure this in MAX.  You can, however, generate code from a task you have created in MAX (but not using test panels) and insert the reserve step.


Message Edited by MarkGrot on 03-04-2008 01:03 PM
Message 2 of 7
(8,545 Views)

Thanks for your response!

Apparently it is not as obvious as one might think. This also became clear when I contacted NI here in the Netherlands.

As a work around, it was suggested to set the required bit (bit7) voor high output, then close the task, then start a new one for counting (Least Sinificant-nibble).

This worked fine for me, but is not a general solution.

I'll look into this. Would be nice if there's an example for this.

Thanks again.

0 Kudos
Message 3 of 7
(8,528 Views)

Here's an example of how to utilize the nibble DI/O configuration on the 9401 to trigger an analog input task.

 

 

Developer Zone Community: Nibble DI/O Configuration for Triggering with NI 9401
Message 4 of 7
(7,581 Views)

Also, 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...

 

Another community example in addition to my previous post is linked at the bottom of that KB.  I hope it helps!

 

- Greg J

0 Kudos
Message 5 of 7
(7,383 Views)

while running the example pgm given under fpga,Crio, digital input and outout port how we test the port in 9401 gives output or not???

0 Kudos
Message 6 of 7
(7,125 Views)

I know it is possible to configure the 9401 to have 4 input and 4 output channels, but is it possible to configure the card to have two separate ports for output?  I need one of my outputs to be a constant digital signal, and the other to be a single high/low output triggered by an external source (could be user pressing a button, prox sensor, etc).  When I try to do this with all 8 ports configured for output, I get error 201133 indicating the channel is in use by another task.  I have my constant output on channel 0 and my single value on channel 7.  When I set up a task right now it shows only one port with all 8 channels in it, I want two output ports with four channels each.  Is this possible?

 

I have attached an image of the ports/channels as I see it now

0 Kudos
Message 7 of 7
(5,819 Views)