Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxBaseDIOReadxx functions do not work consistently

I have written an application based on DAQmx Base that does various things, including DIO reads. I have compiled it on both Macintosh and Windows; on Macintosh I use it with E-series, M-series and USB devices. Clearly, on Windows I use it only with USB devices.

I first built it on Macintosh and tested with a PCI-6014 E-series device. Using that device, I could read DIO lines calling DAQmxBaseReadDigitalScalarU32() without first calling DAQmxBaseStartTask().

On Windows, using a USB-6008 if I omit the call to DAQmxBaseStartTask(), I get error -1073807346 returned from DAQmxBaseReadDigitalScalarU32() (or any other DIORead call). Naturally, I get no info using DAQmxBaseGetExtendedErrorInfo().

I cite the error number because...

On Macintosh I tried it with the USB-6008, and got the same behavior, right down to the exact same bogus error number!



I don't necessarily expect to be able to call the DIORead functions without first starting the task. I tried it because with DAQmx you don't have to call DAQmxStartTask() before a read operation. Checking the documentation for DAQmxBaseStartTask(), I find that this is not, in fact, allowed.

I *do* expect it to be consistent.

I *do* expect the error code to be meaningful.
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 1 of 3
(2,894 Views)
Hello John,

As documented, the normal way of programing requires a call to StartTask. As long as you follow the normal way, everything is consistent. Things become insconsitent when you try something else like trying to read from a tast that has not been started. There are many ways that programmers can do wrong and we just can't attempt to make sure that they get the same behavior for things done outside of what the documentation prescribes.
As the error you got said, you were attempting to read from an invalid reference and you need to start your task to fix that problem.
Message 2 of 3
(2,873 Views)
Thanks, Serges.

As I said, I don't actually expect it to work, just to return a real error code.

The code was tested *and worked* with a PCI-6014 on Mac OS X. On both Windows and Mac OS X it failed with a USB 6008. It would be nice if it were consistent.

The requirement of starting the task before doing a single-point reading is different from NI-DAQmx. As far as I can tell, that difference is documented *only* in the reference documentation for DAQmxBaseStartTask(), which makes it hard to find if you think that call isn't necessary because you've been using NI-DAQmx.
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 3 of 3
(2,862 Views)