Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital in and out on the same I/O line (DAQmx)

I'm connecting to an external port that connects to a bus on a test board. The bus will either be excepting digital data from my DAQ board or it will be sending digital data to the DAQ board. The direction change will be controlled by the LV app with another digital output line. I'm setting up one task reference for input and another one for output.
 
My question is when I'm switching from digital out to digital in (with respect to the DAQ board) what do I need to do? I don't want to have a voltage sitting on the line when I tell the external bus to switch directions. I'm not sure how to tell the DAQ board that it should switch over and be ready for an input.
 
George
0 Kudos
Message 1 of 5
(2,814 Views)
It sounds like you should be planning on using the tristate property, if your board supports it.  More info can be found in this thread.
 
-Kevin P.
CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 5
(2,795 Views)

I used the tristate and it works fine. I'm a little confused about setting up the task though. Orginally I had setup two tasks, one for input and one for output - both referenced the same port. I had to clear the write task before I could use the read task. After reading the references above I tried it again with only one task. This task is setup for Digital Output on the port. What I don't understand though is how I can do a read using a task setup for output. This is nice because I don't have to setup the task before each operation, but I don't understand why it works.

George

0 Kudos
Message 3 of 5
(2,784 Views)
I guess it's just one of those situations that doesn't map nicely to the overall spirit of the DAQmx API.  The same kind of issue caused me a hiccup too when I was just starting to switch over to DAQmx.
 
When I think about it, it *does*make sense to implement the ability to Read from an output task rather than to have to deal with managing separate tasks mapped to the same physical signals.  It just wasn't obvious to me at first that I should even bother to try.
 
-Kevin P.
 
 
CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 4 of 5
(2,767 Views)

Hi George,

A digital output task is inherently bidirectional.  When you call DAQmx Read, it configures the port for input and then reads the data.  When you call DAQmx Write, it configures the port for output, and writes the data.  If, after a Write, you want the port to stop driving before you are ready to Read, then you can set the tristate property.

0 Kudos
Message 5 of 5
(2,766 Views)