05-13-2020 11:30 AM
Hello,
I am a "newbie" with NIDAQmx and a former user of traditional NIDAQ
library in C/C++. I use an "USB-6212' board. I am trying to migrate all
my NI applications from NIDAQ to NIDAQmx and it is a bit puzzling...
My question is the following:
the function 'error=DAQmxGetDevSerialNum( "Dev1", &SerialNumber )' delivers a valid
serial number (ex: 30974407) when my USB-6212 board is connected. BUT,
when I physically unplug the USB plug of my board, the same function still delivers
the SAME serial number (and not 0), and the return code 'error' is still 0 (success).
So, I cannot anymore use this function to verify that my board is actually connected
(as I used to do with traditional NIDAQ).
More puzzling, the 'DAQmxGetDevIsSimulated( "Dev1", &Simulated )' sets the variable
'Simulated' to 0, whether my board is connected or not...
So, how can I assess programmatically the presence of the board ?
Thanks in advance for your help !
J.P. Rivet
05-13-2020 12:53 PM
The MAX database retains the association between the device serial # and its common name or alias (like 'Dev1'). This is meant as a feature, not a bug, so that the *same* name/alias can be associated with the device whenever it's present, no matter how many USB detachments and reattachments of various things have happened in the meantime.
The idea of a 'simulated' device is distinct from this.
In LabVIEW, I didn't quickly find a device-related property that looked like it would help me identify whether a USB device was physically attached or not. You may need to try to create, maybe run, and then clear a simple task on the device. You'll get an error if the USB device isn't attached.
-Kevin P
05-13-2020 02:49 PM
Hi Kevin,
Thank you for your quick answer !
Things are clearer now...
With my best regards
J.P.