NI-DAQ device working on some PCs but not others

15 visualizaciones (últimos 30 días)
Leigh Martin
Leigh Martin el 1 de Jun. de 2021
Respondida: Leigh Martin el 4 de Jun. de 2021
We are running a National Instruments DAQ (NI-DAQ) in Matlab using the provided dll (NIDAQmx.dll). It is working on one of our PCs (Windows 7, Matlab 2015a), but not two of our other PCs (Windows 10, Matlab 2015a nor 2021a, Windows 10, 2017b). We are confident that it worked in December 2020 on at least one of the Windows 10 PCs. On the Windows 10 PCs, we can use it fine via the built-in NI interface and Matlabs 'session-based' interface, but we have lots of code written around the dll version and need that working.
Below is a minimum example that reproduces our issue:
Device = 'Dev2/ao0';
DAQmx_Val_Volts = 10348;
Voltage = 0.0;
TaskName = []; % An additional error occurs if this is non-empty, but only on Windows 10.
[ statusCreateTask, TaskName, task ] = DAQmxCreateTask_(TaskName);
statusCreateChannel = DAQmxCreateAOVoltageChan(task,Device,-10,10,DAQmx_Val_Volts);
statusWriteAnalog = DAQmxWriteAnalogScalarF64(task,1,0,Voltage);
statusClearTask = DAQmxClearTask(task);
fprintf('%i, %i, %i, %i\n', statusCreateTask, statusCreateChannel, statusWriteAnalog, statusClearTask)
CreateVoltageChan and WriteAnalogScalar both produce the error -200088, which means "-200088::Task specified is invalid or does not exist." This occurs regardless of whether the device is plugged into our PC.
Strangely, Setting TaskName to anything but [] raises the additional error "-200089 DAWmxErrorDuplicateTask" after subsequent calls, but only on the Windows 10 PCs.
We have also tried restarting everything, installing Windows updates, installing the latest NI drivers and rolling back to previous drivers.
This post from 2013 describes a very similar problem. However TaskHandle is already defined as uInt32 in our NIDAQmx.h file, so the answer there doesn't seem to be relevant.

Respuesta aceptada

Leigh Martin
Leigh Martin el 4 de Jun. de 2021
In the NI I/O Trace capture program, I noticed that the handle generated by DAQmxCreateTask didn't match the handle passed to subsequent functions. 0x000001EE81212De0 would get truncated to 0x0000000081212DE0, which is a 32 bit number. So in NIDAQmx.h, I changed the following line:
typedef uInt32 TaskHandle;
To
typedef uInt64 TaskHandle;
And now the problem is solved.

Más respuestas (1)

LO
LO el 1 de Jun. de 2021
Have you tried uninstalling completely and reinstalling the NI-DAQ Data Acquisition Toolbox ?
I have encountered troubles with the 2020 version of MATLAB (on windows 10) and it did not work until Irepeated the install process, at least a couple of times. In some cases the download&install package did not work properly (it got stuck).
If that happens, try to remove the installed components form MATLAB and also erase them from the PC (from the MATLAB installation folder). Install again.
  3 comentarios
LO
LO el 1 de Jun. de 2021
In my case I can't even run an acquisition session without the toolbox, I am using windows 10, MATLAB 2018 and 2020.
I am using both USB 6211,6212 and PCI express ni devices.
For all these I need the toolbox installed.
I wonder actually how can you run data acquisition without it :)
Leigh Martin
Leigh Martin el 1 de Jun. de 2021
I think I misunderstood dependencies between software then. We do have the data acquisition toolbox installed. We don't use direclty use any functions from it (at the lowest level, all we use are 'loadlibrary' and 'calllib', which calls functions from micaiu.dll).
A fresh install on a completely separate computer did not fix the problem, so it seems like this is a lower-level compatibility issue.

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by