Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

clearing resource cache in visaNS

Solved!
Go to solution

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?

0 Kudos
Message 1 of 14
(5,562 Views)

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

0 Kudos
Message 2 of 14
(5,464 Views)

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.

0 Kudos
Message 3 of 14
(5,461 Views)

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

0 Kudos
Message 4 of 14
(5,447 Views)

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.

0 Kudos
Message 5 of 14
(5,441 Views)

Just to make sure, do these devices show up in MAX after being disconnected?

0 Kudos
Message 6 of 14
(5,431 Views)

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.

 

0 Kudos
Message 7 of 14
(5,427 Views)

If you remove these devices from MAX do they still show up after using the FindResources function?

0 Kudos
Message 8 of 14
(5,408 Views)
Solution
Accepted by topic author joemg

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.

 

0 Kudos
Message 9 of 14
(5,403 Views)

I think that sounds like a good plan. Have a great rest of the day!

0 Kudos
Message 10 of 14
(5,395 Views)