LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Read changes DIO to output?

wow, it's been a looong time - been doing PCB design (yuk!) but I'm glad to be doung some LabVIEW again... anyway, on to the question.

Using a 6025 DAQ card, and an express vi (built from DAQ assistant), I'm sending a True to a specific Line of a Port. Next, I want to read that same Line on that Port. However, when I read it, the "bit" is reset - reads False. I think what is happening is, the direction of the DIO changes to an output when you read the Line / Port. Is that correct? So, how would I read that bit after setting it, without "resetting" it??? Seems like LabVIEW 101, but I'm stumped.

Thanks,
Richard
LV 7.1
Richard






0 Kudos
Message 1 of 4
(2,782 Views)

I think what is happening is, the direction of the DIO changes to an output when you read the Line / Port. Is that correct?
You would have configured the Line as a Digital output, when you do a DAQ assistant 'write' to a digital line.
 
When you try to read it, DAQ assistant will reconfigure it as a Digital Input and reset it to its default value.
 
So, you cannot set a line and read its boolean value as you are trying to do.
 
What you could do is make one line on port Digital Output ( write to it) and configure other Line as Digital input ( read on it)
 
Hope this helps,
Regards,
Dev
 
 
Message 2 of 4
(2,771 Views)

Thanks Dev, that confirms what I thought.

Your idea about two different lines (one to write, one to read) would not work for my purpose, since I want to read the exact line that I have set high (or low). That would work if I wired one line to the other (physically) but I can't do that. Looks like I'm going to have to rely on (physical) LED's to check the status if I want to leave the line as a Write.

 

Richard






0 Kudos
Message 3 of 4
(2,761 Views)

Or you can simply program the DO task yourself instead of using the DAQ Assistant.  Personally, I'm of the opinion that if you're allowed at least a half hour to program your application, you shouldn't even consider the DAQ Assistant.  The forums are littered with all kinds issues people have due to the somewhat hidden limitations of the DAQ Assistant and Express VI's. 

If you create a DAQmx DO task from scratch by following one of the shipping examples, you will be able to insert a DAQmx Read call to read back the state you are presently outputting.  With DO tasks, you can both Write and Read the output bit.

-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).
Message 4 of 4
(2,758 Views)