LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx discover if a device is present programmatically

Solved!
Go to solution

So I looked through all the nodes I could find in the Advanced DAQmx menu.  I can't find this most basic information, if a given device is currently physically attached to the computer.  

 

I have an application on a laptop for various types of thermocouple boards. Other engineers use it for testing.  They choose which board to use.  I want my program to be easy for them and adapt to any of the boards they have now.  They all have different characteristics I need to track. To do that I need to know which board they plugged in.  

 

DAQmx has a record of every board of every type that was ever plugged into the computer.  When I look at DAQmx Device -> ActiveDev class and get any information, it returns info for the complete list.  Not just the boards that are connected now, but the entire history.  There is not a Boolean for Device Present.  The Boolean for DeviceIsSimulated is always false.  

 

The software clearly knows this info, if you look at NIMax there are red flags for non-connected hardware.  Is there any way I can get that programmatically?  

 

I tried doing something to all the listed devices (create task, read data) to look for errors.  The only error I got was -20077, unsupported measurement type.  No "Device Not Present."  

 

Thanks

Ed

0 Kudos
Message 1 of 9
(2,785 Views)

Have you rummaged around the stuff in Measurement I/O -> System Configuration?  You can access NI-MAX from there.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 2 of 9
(2,767 Views)
Solution
Accepted by topic author AndyTailored

When I scan the instruments I do not see devices that are not plugged in. See below. Dev1, cDAQ3 is missing from the scan but shows in MAX. How are you scanning instruments?

 

Snap83.png

 

mcduff

0 Kudos
Message 3 of 9
(2,759 Views)

<sigh> as always the answer is to turn off the power and start again.  I don't know what happened or what I was looking at, but now it works.  I was scanning exactly that way and seeing wrong things. I unplugged everything cycled power and presto.  

 

Once again, a helpful member has shown me the obvious answer.  Thanks.  

 

Ed

 

0 Kudos
Message 4 of 9
(2,739 Views)

Note that method won't detect any PXI chassis. See here for another method.

 

Lastly, the method in that link is slower than the earlier solution and sometimes the System configuration VIs hang. Only use if absolutely needed for a PXI system.

 

mcduff

0 Kudos
Message 5 of 9
(2,729 Views)

OK, it's the FieldDAQ.  LV and MAX still show it in the system after pulling the Ethernet.  I see you have one in your system, do you see the same behavior? 

 

I just thought it did that with all instruments, sorry.  

 

How to see if it's really there?  I can open a TCP connection to port 80 and check for errors.  That works.  I don't want to shell out to Windows for a ping.  Any other suggestions?  Is there a way to force a refresh of DAQmx devices from LV?  

0 Kudos
Message 6 of 9
(2,710 Views)
Solution
Accepted by topic author AndyTailored

I do not have a real FieldDAQ. I made a simulated one to test a general purpose program to see if it is general enough to apply to FieldDAQ. (It works for simulated devices.)

 

You can try the attached following; it uses System Configuration VIs. (I need to use both to get a complete list) Modify as needed I use it to do a complete scan so you can change type def etc as a lot of that stuff does not apply to your situation. (One of the Configuration filters is for Network Devices, see if the output changes when disconnected.) V2016 attached.

 

Let me know if there is a problem with it. The Main VI is called untitled 4 , I just copied and pasted into a new VI and saved for previous version. Sorry about the name.

 

mcduff

 

 

 

 

 

 

0 Kudos
Message 7 of 9
(2,707 Views)

Ni Has something built to do this. It will show you everything connected to your computer

 

Example.png

Tim
GHSP
0 Kudos
Message 8 of 9
(2,699 Views)

Revisiting this problem with real equipment this time.

 

I do not have a FieldDAQ but a networked cDAQ chassis. While testing what errors would occur if the chassis network cable became disconnected while using, I found the DAQSystem Device Names node was still listing the chassis even though it was disconnected.

 

Below and attached is one possible solution, but it seems a bit Rube Golberg. It works but maybe someone here can improve it. I assume it will work for other network devices also but have not tested.

 

snip.png

Download All
0 Kudos
Message 9 of 9
(602 Views)