LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Alias won't stay assigned in MAX

Several years ago, I developed my own NI-VISA driver for a USB spectrometer.  On Windows XP, they worked great - I could plug multiple spectrometers into the system, assign each one an alias in MAX, and then acquire data from whichever spectrometer I wanted. I could even unplug a spectrometer, and plug it into a different USB port and automagically the alias would follow it.

 

Then came Windows 7.  Suddenly (with no code changes or changes to the driver), if the spectrometer was assigned an alias, then it ALWAYS had to be plugged back into the same USB port or the alias would not follow it.  The alias would still be in MAX, but the spectrometer would be on another port.  It was as if the alias wasn't just linked to the device, but the specific USB port as well.  I'd have to manually delete the old alias and reassign it to the "new" spectrometer & port.  Annoying, but not the end of the world.

 

But then it got really bad... Due to a recent engineering change that moved the spectrometer further away from the PC, even a 15ft USB cable isn't long enough.  I have to connect my spectrometer to the PC using a Rose USB extender (USB-to-Ethernet-to-USB).  Even though I never physically unplug the spectrometer, every time the power is cycled on the PC I have to manually reassign the alias.

 

This is a major issue for my application.  I'm at the point where I'm thinking of giving up aliases entirely and just having to search for spectrometers based on serial numbers.  But if we have to swap out a spectrometer in the field, we'd have to update a serial number config file or something equally ugly.  Can anyone suggest a way I might be able to make the alias behave more like it did under windows XP?  Or suggest another more robust solution? 

 

Thanks,

JasonP

0 Kudos
Message 1 of 8
(4,363 Views)

Jason,

 

First, do you know if the versions of MAX and VISA that you are using are the same in Windows 7 as they were when you were using Windows XP? Also, knowing the versions of each would be helpful.

 

In the meantime, take a look at this KnowledgeBase article and see if it helps: http://digital.ni.com/public.nsf/allkb/04833653AA9B2CF0862574EB0010D843

 

By forcing the devices to be recognized as static instead of dynamic, you might be able to keep the aliases consistent across reboots.

 

Regards,

Brice S.

Applications Engineer

National Instruments

www.ni.com/support

0 Kudos
Message 2 of 8
(4,337 Views)

Hi Brice,

 

Thanks for responding!  I'm currently using DAQmx 9.3.5 and VISA 5.1.1.  Back in the XP days, I was using whatever shipped with LV2009.  I made the switch to Win7 while I was still using LV2009 and saw the problem back then, but it wasn't a serious problem until I got stuck using these USB extenders. I'm not sure the knowledge base article applies... My device isn't ethernet, but USB.  The Rose Electronics USB extender has two USB ends connected by an ethernet cable.  It just allows us to position the device more than 15ft away from the computer.  But from the PC's point of view, the device is just a normal USB device.

 

JasonP

0 Kudos
Message 3 of 8
(4,330 Views)

Does the resource name in MAX change each time you reboot the PC? If not, you should be able to link the resource name to the Alias you want to use. If the resource name does change, does it follow some sort of pattern?

 

Also, could you provide a link to the USB extender you are using? The spec sheet for it might provide insight into what is causing this problem.

 

Regards,

Brice S.

Applications Engineer

National Instruments

www.ni.com/support

0 Kudos
Message 4 of 8
(4,311 Views)

Hi Brice,

 

If you look at the attached image file, you can see the problem.  The entries I've circled represent the same physical device.  You can see that the serial number assigned to the device has changed from "NI-USB-30002" to "NI-USB-40002".  If I leave the spectrometer plugged directly into a PC, I can reboot it without issue.  But if I unplug it, or if it is connected to the PC through an ethernet-based USB extender, then the reboot changes the serial number as shown.  And of course, trying to access the device using the alias will fail.

 

In my application, I might have as many as six spectrometers connected to the same PC.  If I can't use aliases, I'll have to connect with each spectrometer, query it for it's internal serial number, and match it against an configuration table.  I really was hoping to avoid that if at all possible.

 

Thanks,

JasonP

 

PS:  I can't find the exact documentation for the extender we have, but the one shown in the attached PDF is very similar.

Download All
0 Kudos
Message 5 of 8
(4,303 Views)

One thing I'd like to know: Does the Windows Device Manager recognize the device by the same name each time the PC is rebooted? Because if it doesn't, I don't see any way that MAX will be able to.

 

Regards,

Brice S.

Applications Engineer

National Instruments

www.ni.com/support

0 Kudos
Message 6 of 8
(4,280 Views)

You can set-up an exe to run in NI Devmon and even use the specific device ID (serial number) to set a MAX alias using the System Hardware API.  

 

 

Oh how I wish I had tagged that KB.  /\/\/\/\/\/\ Hand waving! 


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 8
(4,273 Views)

Guys,

 

Thanks for trying, but I ran out of time and had to move ahead with the approach I was trying to avoid. 

 

Jeff - I was thinking the same thing, but in the end I couldn't make it work.  The device does have a serial number, but it's buried in the firmware.  It isn't exposed directly, so a pseudo-serial number (e.g. "NI-VISA-10001", etc.) is autogenerated each time the device changes ports. I ended up scanning for all VISA devices with the right Vendor and Product codes, then connecting with all of them and querying them for their real serial numbers... and once I'd gone that far, there wasn't much point in using an alias.

 

Thanks,

JasonP

0 Kudos
Message 8 of 8
(4,271 Views)