Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NIDAQmx programmatically check if device available C Code

Hi,

I am writing C code using NI-DAQmx 8.6

Can you please let me know how to programmatically check if a device is accessible or not. My device is NI USB 6221.

I found the following API but these don't tell if device is connected and accessible whereas on the device list of measurement and automation studio, we can immediately see if a device is connected from its icon.

uInt32 productNumber=0;
DAQmxGetDeviceAttribute(device,DAQmx_Dev_IsSimulated ,&productNumber);
 //productNumber is set 1 if device is simulated.

DAQmxGetDeviceAttribute(device,DAQmx_Dev_SerialNum ,&productNumber);
// returns the serial number of the device

DAQmxGetDeviceAttribute(device,DAQmx_Dev_ProductNum ,&productNumber);
// for NI USB 6221 it returns 0x72dc

What is the API call to check if device is connected or not?

Thanks,
Hasan Ayaz

PhD Candidate
Biomedical Engineering



0 Kudos
Message 1 of 3
(3,290 Views)
Hi Hasan,

Thanks for contacting National Instruments.  The information you are looking for is a property of the system, which may be why you had trouble finding the correct function.  You can use the DAQmxGetSysDevNames function to get a full list of DAQmx devices that are installed on your system (same as what would appear under NI-DAQmx Devices in Measurement and Automation Explorer). 


Best Regards

Hani R.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(3,271 Views)
Dear Hani,

Thank you for your reply. I wish the NI-DAQmx documentation was more exhaustive. In any case, thank you for the information.

Sincerely,
Hasan
0 Kudos
Message 3 of 3
(3,263 Views)