I am trying to get my head around the behavior of VISA here, and what happens to VISA references when an instrument is initialized. The initialize function I am referring to is the one generated from VXI Plug&Play "compliant" LabWindows/CVI instrument driver DLLs. All I have is LabVIEW wrappers for them.
Before I run my initialize function, if I look at a VISA control, it lists all the instruments in my system - just like I expect.
ie VXI0::1::INSTR, ... VXI0::8::INSTR
After I run the initialize function, a NEW reference is created for the instrument, which means there is now TWO references for the same instrument.
ie VXI0::1::INSTR, ... VXI0::8::INSTR, VXI0::1::INSTR 2
The code for the function is hidden in a DLL wrapper, which in addition to the DLL contains an "IVI New Session" function. It is like this for ALL the instruments based on this type of driver (wrappers around CVI DLLs).
What confuses me is that some of my instruments won't work until after I run this initialization function, and then some functions will only work with the NEW VISA reference - not the old one. (Other functions work with either VISA reference)
So what I am wondering is why doesn't the function just return the VISA session that already exists - and why are some functions fussy about which VISA session is used, while others aren't.
With the combination of MAX and the new VISA references, I was looking forward to not having to create my VISA references from resource name strings. To bad it isn't that simple.
Thanks for any insight you can provide,
John Howard
PS: The reason this is a problem for me is that I am trying to use a global variable to contain information on all the instruments that SHOULD be connected to a system. When the software runs - it verifies all the instruments and reports any that have communication problems. This is where I am running the initialize function on some instruments. My reasons for using a global are many, but it all goes back to the fact that we are using NI's old Test Executive, which runs test steps that have no knowledge of each other, and no way to pass information (VISA sessions) between them.