MORECHEMISTRY.COM::MORE CHEMISTRY ON THE WEB
Home | Member Area Links Events Publications Promotions
  refresh page

LabVIEW utilities - find connected usb-6009 device

Find out which USB-6009 is connected to your computer

The problem

Suppose you have 4 PCs and 4 USB-6009 devices. And suppose you want to be able to use any of those devices on any of those PCs. That looks easy enough, but there is a small issue: Each device has its own ID and will be given its own name, like Dev1, once connected to a PC for the first time. If your LabVIEW application uses Dev1 then only one device will work. That is the one device that was connected first to that particular PC.

So you could connect (for the first time) device A to PC A, device B to PC B and so on. With tags both on the device and on the PC things should work out fine. But what if for some reason one device should be used on another PC or you don't want any tags?

The solution

The solution to this problem is as follows. First attach each device, one after the other, to each PC once, so they will be known as Dev1, Dev2, Dev3 and Dev4.. Then pick (and attach) the device that will be used by the application. Let your application first try to collect an analog input using Dev1 through Dev4. The one device that returns no error apparently is the connected device.

In LabVIEW

Put a reference to the first analog input channel for each of the devices in an array:
a reference to the first analog input for each usb device

Try to measure an analog signal for each of those channels and remember which one caused no error:
loop to try each usb device

Offer some information for further processing:
show which device was found or an error if none was found

Downloads

finddevice.vi
LabVIEW sub-vi which shows which USB-6009 has been connected

Note: This DAQmx based vi has been made with LabVIEW 7.1 Full Development System.


Bart Boshuizen, 2007/10/27


© copyright 2000-2008, morechemistry.com
design by Bb.