04-19-2012 08:30 AM
I'm still kind of new with LabVIEW, and I came across the VISA open/close functions (they were hidden under the Advanced tab so I never saw them before).
My question is if I am supposed to be using those VISA open/close functions when I make gpib drivers for equipment I use. For example: attached is a simple code that will set up my Keithley 181 and take a measurement (really only for demonstration purposes). I highlighted the open/close functions, I have never actually used them before, and normally if I wanted to write the same code I would have just skipped them and gone straight to the VISA write (which still works). I haven't seen any problems with the drivers I have made, even though I have not used these functions in the past, but maybe there is a chance that some unexpected results could occur, I am not really sure.
Thanks!
Solved! Go to Solution.
04-19-2012 09:15 AM
Hi Lars,
let's compare VISA with simple FileIO:
First you open a file (providing it's filename), then you read/write the file, then you close the file. You do the same with VISA: open the connection, read/write data, close the connection...
It's the same when using DAQmx, queues, and many other: open the resource, work with it, and close the resource afterwards!
04-19-2012 09:39 AM
Once upon a time, the use of the VISA Open was required. A session was not created unless you explicitly called it. Then, VISA got a bit smarter and if a VISA function is called, if the session does not already exist, it is automatically created. So, calling the Visa Open is somewhat optional though I still prefer to use it in my code. With the VISA Close, there is a setting (tools>Options>Environment) that will automatically close VISA sessions when you exit the top level VI but, especially with serial, I prefer to have more control.