05-10-2009 10:50 AM
I use viParseRsrcEx to search for my aliases as in:
status = viParseRsrcEx(defaultRM, ViRsrc(Aliases[aliasNumber].c_str()), &intfType, &intfNumber, rsrcClass, unAliasedName, aliasIfExists);
I give the command the alias name in Aliases string vector and get the address in unAliasedName and the alias again in aliasifExists. I use checking mechanisms afterwrads to make sure the aliases exist and ...
The problem arises when finding USB devices. Here is what viParseRsrcEx gives me:
For my USB devices I get: "USB0::0x0957::0x2018::0115001486::0::INSTR" as the unAliasedName but MAX and viFindRsrc give me: "USB0::0x0957::0x2018::0115001486::INSTR" as an address.
Using the unAliasedName form viParseRsrcEx in viFindRsrc results in not finding the device and the reason is the 0 difference before the ::INSTR.
Can anyone explain me the fields in the address and why viParseRsrcEx gives me different address format and how can I have them in same format for MAX, viFindRsrc and viParseRsrcEx.
Currently I parse the address and correct the issue for the USB but it is kind of a hack than a permanent solution. I like to understand what the fields are and why are they different between two commands and thr MAX enviroment. Thanks a lot for your help.
05-13-2009 08:51 AM
Hi Zeino,
Are you using C or VB?
Regards,
Sammy Z.
05-13-2009 09:12 AM
Hello Sammy,
I use Visual C++ on Visual Studio 2008 environment.
zeino
05-13-2009 02:52 PM
Hi Zeino,
VISA help is a really good resource. If you go to
Start»All Programs»National Instruments»VISA»Documentation»Visa Help
and search for "parse" you can find a greate tutorial on viParseRsrcEx and viParseRsrc.
In that, it is mentioned that:
The value returned in unaliasedExpandedRsrcName should in most cases be identical to the VISA-defined canonical resource name. However, there may be cases where the canonical name includes information that the driver may not know until the resource has actually been opened. In these cases, the value returned in this parameter must be semantically similar.
So, it is not guaranteed that you would get the same address with or without the USB Interefac number every time.
As a result, I would say that altering the string manually is the way to go.
As for what each one of those fields mean,
Please look at figure 8 in the link below.
http://zone.ni.com/devzone/cda/tut/p/id/4478
So, the fields show the manufaturer, model, and serial numbers.
Regards,
Sammy Z.