06-29-2010 10:25 AM
Set the Tools> Options> Enviroment> property Automatically close VISA Sessions to TRUE and STOP using the VISA Close function! It's obsolete.
06-29-2010 10:42 AM
@Jeff: Fair enough, though if I let LabVIEW automatically managing opening/closing of sessions, is there a way of programmatically checking the session state?
06-29-2010 11:10 AM
Is there a way of programmatically checking the session state? Interesting question.
The session refered to by the WIRE is similar to a reference to a session. Weather the VISA API still holds an "open session" with that same information is up to VISA and not really visible from LabVIEW except on a VISA Ser instr PROBE. (a conditional probe could pause on an invalid session) but I know of know good way to expose this without using the error cluster. A call to a VISA function with an invalid session ID will return an invalid session error. So the solution is to have good error handling rather than worry so much about VISA session maintenance. The error cluster is your friend in this and several attempts have been made over the years to generate a "General VISA error handler" routine with options to alert the user to unexpected behaviors (Like some operator shut off the equipment by accident.)
How your application needs to respond to errors will depend on the application's requirements. I generally pop-up a user message and log errors. You may want to attempt recovery- generally, this is much harder as LabVIEW really has no direct link to the hardware and can't reconnect a cable. I depend on the trained operator to notice equipment states and recover manually.
06-29-2010 07:00 PM - edited 06-29-2010 07:01 PM
@BlakeJ wrote:
When flow control is set to "none", shouldn't the RTS and DTS be left alone?
Depends- on what is left in charge. When VISA closes a session it returns control to the OS. NOT a LabVIEW thing, LabVIEW just "got out of the way of the OS." and the OS settings are re-applied. (DOH++) I missed it all day too!
Re-reading Ben's earlier post
"Have you looked at the default setting the OS applies?" pulled my head INTO the right box---- the OS!