03-02-2011 05:16 PM
I'm having trouble finding all the resources using the FindResource method. I have 2 devices attached, one is a built-in COM port and the other is
USB device attached (Tektronix TDS2014B). VISA Interactive Control shows things correctly:
However, in my VisaNS built application, I get only 1 result:
string filter = "?*";
ResourceManager mgr = ResourceManager.GetLocalManager();
string[] resources = mgr.FindResources(filter);
resources[0] = "ASRL1::INSTR"
resources.Length = 1
I'm using NI-VISA 5.0.3 with the NET3.5 assemblies.
Any ideas?
03-02-2011 06:29 PM
For some reason, the message board software threw away my first screen capture of VISA Interactive Control, so here it is again.
03-03-2011 02:06 PM
The help for the function is as follows:
Matches the value specified in Expression with all known instruments. On successful completion, the Return Count is the total number of matches and the Instrument Descriptor is the descriptor string for the first instrument that matches Expression. The Instrument Descriptor can be used to open an instrument with the viOpen operation. The Find Handle can be used in subsequent calls to the viFindNext operation to retrieve descriptor strings for the remaining instruments that were found.
This operation applies to VISA resource manager sessions only.
/*-------------------- Prototype ---------------------*/
ViStatus viFindRsrc (ViSession Rsrc_Manager_Handle,
ViString Expression,
ViPFindList Find_Handle,
ViPUInt32 Return_Count,
char Instrument_Descriptor[]);
If you look at the strings that are being passed in for the "char Instrument_Descriptor[]" parameter the value you pass is different then that passed by Interactive control. You may want to look into those differences.
03-03-2011 02:33 PM
The VisaNS interface does not give me any access to the actual arguments passed to viFindRsrc().
In addition, the Instrument_Descrption[] is an output parameter of viFindRsrc -- NI Spy is showing the result of the function call, not the input to the function call.
I plugged in a different Tek USB scope, and the same result occured: the VisaNS call did not return the USB device.
I ran the same code on 2 other machines in our lab (one running Win7 and one running WinXP), and both other machines actually did return the USB device in the call to FindResources("?*"), while my laptop did not return the USB device. It must be some configuration glitch of the NI installers, but there's no way I would be able to figure that out because it is way too complicated to figure out where the 1/2 gigabyte of install stuff went on my machine for VisaNS...
I'm still stuck. It's going to be difficult to be able to support random devices if I don't have a programmatic way of detecting what is attached!
03-04-2011 04:16 PM
I am sorry about the last response. I didn't look into it as closely as I should have. Are there any differences in what software is installed on the computers that worked and the laptop that didn't? For example, different VISA driver versions. What type of Laptop?
03-04-2011 05:51 PM
My laptop is Windows 7 64 bit. It's a Core2 Duo from about 2 years ago.
The other two computers are 32 bit (Win7 and WinXP). Maybe that is the reason.
Both machines that are running Windows 7 have the 5.0.3 VISA installed.. The WinXP machine had an older version of VISA (4.4 I think).
In terms of conflicts/mismatches, it seems that *my* development machine (where I use Visual Studio 2008 to build) should be the most consistent since everything is on the same machine. The other 2 machines may have inconsistencies. However, the other two machines work ok, while mine doesn't.
03-08-2011 02:06 PM
I don't see anything that should be wrong. Have you taken spy catures from the two other computers that work in the lab to see if there are any differences in the commands they send?
03-25-2011 03:06 PM
Greetings,
We are having similar issues when upgrading to Windows 7 64bit. XP SP3 works fine. First when running NI-Visa 5.03 then down grading to NI-Visa 5.01 has the same issue, in not returning all listening devices. Running supplied NI C:\Users\Public\Documents\National Instruments\NI-VISA\Examples\DotNET3.5\FindResources\vb program displays the issue. Here
03-25-2011 03:09 PM
Added images of the programs from my previous post.
03-25-2011 03:26 PM - edited 03-25-2011 03:26 PM
I have not taken captures on the other machines where it is working (it is a bit of an effort to do so).
I do notice the following in my screen caps:
The handles of the 1st and 3rd arguments that are passed to viRscFind() look substantially different.
In the example from VISA Interactive Control, the values are 0x0x2425720 and 0x0243F898, which look like memory pointers.
In my .NET example, the values are 0x00001001 and 0x00002001, which don't look like memory pointers. They look virtual.
In either case, I have no control over those values -- they are controlled by NI written code.