05-20-2017 12:08 AM
VisaNS, Windows 7, VisualC# 2013,
When I execute
string[] resources = ResourceManager.GetLocalManager().FindResources("?*");
I am getting a cached copy. Therefore when i disconnect an instrument the instrument still shows up in the returned list of resources. How can i clear the cache before calling FindResources?
Solved! Go to Solution.
05-30-2017 09:17 AM
Hi Joemg,
Was able to find the page listed below that shows where the temp cache is found in Visual Studio. It seems like you should be able to delete the information from here to clear the cache.
Visual Studio- Clear Cache: https://hanskindberg.wordpress.com/2014/02/27/visual-studio-clear-cache/
Thanks,
ShaneK
05-30-2017 10:15 AM
Thanks for taking the time to respond. I removed the contents of both temp directories and the function still returns a list of instruments which are no longer turned on. I am not sure when you would want to create a cached copy of the list but visaNS does. Not being able to clear the cache from within VS makes the function anomaly worse.
06-01-2017 10:44 AM
I did a little more digging and found the GPIB Interface clear for VisaNS below:
GpibInterfaceEventType Enumeration: http://zone.ni.com/reference/en-XX/help/370627F-01/mstudiowebhelp/html/7c523bef/
What kind of instruments so you have connected to your system that you need to clear?
Thanks,
ShaneK
06-01-2017 11:19 AM
The problem is clearing the list of available instruments not the instruments themselves. I have two Tektronix scopes( TDS 640A and 460) and an Agilent 8712ES network analyzer attached.I need to be able to verify the instruments are turned on and available. The FindResources command returns a string array of instrument names connected to the GPIB interface. The problem is once the list is returned on the first call a disconnected instrument will still show up in the list returned by subsequent FindResources calls. The link you provided is for clearing interface events which is not what I need to do.
The workaround is just to take the list and try and do something with each instrument. The ones that work are obviously available. There must be a way to properly clear the cache or tell FindResourses to not make a cache. So far I have not found that documentation.
06-02-2017 03:09 PM
Just to make sure, do these devices show up in MAX after being disconnected?
06-02-2017 05:10 PM
Yes. I can even disconnect the USB to GPIB interface and both of the attached scope still show up as present and active. When I try to open a Visa Test Panel I get
Error opening resource:
GPIB0::1::INSTR
VISA: (Hex 0xBFFF0011) Insufficient location information or the device or resource is not present in the system.
as expected. If I refresh the tree they are still there.
06-05-2017 04:38 PM
If you remove these devices from MAX do they still show up after using the FindResources function?
06-05-2017 05:25 PM
After installing the Keysight libraries so i could use the Agilent 82357B USB/GPIB interface MAX has been unstable. I set the conflict management as instructed to make NI-VISA and Keysight-ViSA play nice and was able to more or less get things to work expect fot the caching issue which was the topic of this thread. I removed the Keysight libraries and MAX is now stable but of course i can't see my GPIB instruments. I will just get an NI USB/GPIB interface when I have the $654. I will of course seek to assure myself it will work with by Agilent network analyzer before I purchase.
Let consider this a lost cause and move on. Sorry both of us wasted our time trying to solve this problem.
06-06-2017 01:28 PM
I think that sounds like a good plan. Have a great rest of the day!