12-04-2010 12:24 AM
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. Jochen 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.
12-04-2010 04:21 PM - edited 12-04-2010 04:23 PM
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
12-04-2010 08:45 PM
It is exactly what happened and I believe your suggestion should make it work. I will try it later. Thanks.