Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

reading digital line pulls it low always - USB6251

I need to read the status of the digital lines but every time I read them, they are pulled LOW.  The code I used to read is listed below.

 

 DAQmxErrChk (DAQmxCreateTask("",&task));
 DAQmxErrChk (DAQmxCreateDIChan(task, strLine,"",DAQmx_Val_ChanForAllLines));
 DAQmxErrChk (DAQmxStartTask(task));
 DAQmxErrChk (DAQmxReadDigitalU32(task,1,2.0,DAQmx_Val_GroupByChannel,&data,1,&read,NULL));

There is one post http://forums.ni.com/t5/Multifunction-DAQ/Problems-reading-digital-channels-with-DAQmx-tasks/m-p/340... in which Mr.  said M-series card doesn't support digital input without  resetting the initial output state of the lines. Is it really the case? Is there any way to work around if it is true?

 

this is kind of urgent and I would really appreciate someone could reply asap. Thanks.

0 Kudos
Message 1 of 3
(2,806 Views)

Hi David_Lin,

 

I assume that you have another task that has set the digital lines to a certain state, and you want to read the values that are being output. To do this, you can configure your digital input task to disable tristating by calling the DAQmxSetDITristate() function with data=FALSE before starting the task (as mentioned by Tom W in the other thread).

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 2 of 3
(2,796 Views)

It is exactly what happened and I believe your suggestion should make it work. I will try it later. Thanks.

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