Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Closes deletes termination character?

I am currently working on a remote control of a laser using VISA and the actor framework. My Actor (basically an object) holds a VISA address and upon startup the termination character in a "Configure.vi" (see attachement). The object is then passed on and the first query always works but all subsequent ones fail, reason beeing that the termination character is reset from 13 to 10.

 

Also in the attachements is how I currently send my commands to the VISA device. I just write the command, read some data back (it shouldn't really read 256 bytes but that is why I use the termination character) and close the VISA session. So does one of these steps reset the termination character setting of the VISA device? Note that I do not store the VISA address back so I would expect it to be a copy of the one stored in my object. So even if something would change its settings, that should not affect the origial one. But I am clearly missing something here.

Download All
0 Kudos
Message 1 of 5
(4,375 Views)

Simply

only close the visa session when you leave the program, not every call.

Closing means stop that reference (including the reference to the endchar) and open the next time a new reference.

greetings from the Netherlands
0 Kudos
Message 2 of 5
(4,362 Views)

Closing the reference resets the settings.  You should only open the session once at the beginning of your program and only close it at the end.  This is a good practice for all references.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 5
(4,355 Views)

Thank you for the clearification. I thought it would be cleaner to close the session after each request. Learning every day!

0 Kudos
Message 4 of 5
(4,353 Views)
Opening/closing a ton of references leaks a bit of memory too... code's more efficient if you create the reference on init and just pass that around.
0 Kudos
Message 5 of 5
(4,340 Views)