Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Recover from VISA connection loss

Hi, my LabView application is to set a power supply, enable output, and monitor volt and current using VISA based drivers download from NI.  I would like to know if there is a way to recover VISA connection loss when it happens (e.g. cable problem, etc.) while VI is still running.  I hope something can be done in LabView so that if that happens,  I can reconnect cable and the application reestablish VISA connection and continuously monitoring the PS outputs without restart the application.  Thanks in advance!

0 Kudos
Message 1 of 5
(6,591 Views)

In your software, you would have to detect the error (likely from the error cluster), close down your VISA session, and try to conenct again.  Repeat until sucessful.  A State Machine would be a good idea of you really need to do this.


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
0 Kudos
Message 2 of 5
(6,571 Views)

This is what I tried.  I have an idle state reading volt and current from a power supply.  I added extra LV code in the idle state to detect errors.  If error occurs, the code closes the VISA and open VISA again.  To test, I disconnected USB/GPIB cable to the power supply for few seconds and connect it back.  It failed in closing VISA (-1073807338) first try and successfully in second try.   But it failed in opening VISA with error  -1073807194 - Possible reason(s):  VISA:  (Hex 0xBFFF00A6) The connection for the given session has been lost. In order to work again, I have to stop the appl and restart again going through initialization and setting volt and current and enable output.

0 Kudos
Message 3 of 5
(6,534 Views)

Don't let your user's near the connections!  but them inside a locked cabinet.  BETTER, Train them to respect a "Test In Progress" sign.  Cause them pain when they fail to do so!  


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 5
(6,524 Views)

@JÞB wrote:

Don't let your user's near the connections!  but them inside a locked cabinet.  BETTER, Train them to respect a "Test In Progress" sign.  Cause them pain when they fail to do so!  


That is some of the best advice I have ever heard, Jeff.  My other suggestion: avoid USB.  I have had too many issues with it wiggling out when dealing with any type of vibration.  PCI(e) and GPIB seem to work a lot better.


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
0 Kudos
Message 5 of 5
(6,506 Views)