10-17-2012 06:35 AM
Hi,
LV2010, Win7 64bit.
I've got an issue with reconnecting the VISA COM Port when a hardware disconnection occurs. This is when an unexpected disconnection occurs due to a cable fault or some other end point fault.
I can detect a disconnection through the errors produced with the read/write functions which is fine. However when I reconnect the hardware and try to reconnect the port I get the following message:
VISA: (Hex 0xBFFF00A6) The connection for the given session has been lost.
I've tried doing a VISA Close when the error is detected but this just fails with another error. The only way to get it back is to close the application and restart it, usually. In some cases I have to go into device manager to remove the port and start over.
I'd like to handle the disconnection elegantly in the application but can't find anything in LV to enable me to do this.
Any suggestions please.
Dave.
10-17-2012 06:43 AM
10-17-2012 06:45 AM
Yes I've searched and can't find anthing useful. Maybe I'm using the wrong search terms but as I didn't find anything I thought I'd post the question!
10-17-2012 08:41 AM
Tools>>Option>>Enviornment. Select "Automatically close VISA sessions"
10-17-2012 09:07 AM
Tried that, no difference.
Not surprising as the description says the sessions are closed when the VI is idle and mines not idle (at least I don't think so as idle isn't defined). Surely this is effectively the same action as using the VISA close VI? If I use that then as error is reported.
10-17-2012 10:55 AM
OK, What is the "Widget"? How is it connected?
10-17-2012 11:09 AM
It's a FTDI device with a custom COM port driver rather than the one supplied. However I'm not sure that is really an issue because outside of LV, in C#, I don't have the issue. I can pull the plug and then just reconnect after putting the plug back in.
10-22-2012 07:18 AM
Any more comments? It looks like this is a bug I should log with NI.
10-22-2012 09:54 AM
Hi,
I am also using an FTDI device and have been dealing with this type of problems since LV2009.
I use the attached VI to close a VISA COM port. I have no problems reusing the COM port after the device has been reconnected.
10-23-2012 08:24 AM - edited 10-23-2012 08:28 AM
@JorgeF wrote:
Hi,
I am also using an FTDI device and have been dealing with this type of problems since LV2009.
I use the attached VI to close a VISA COM port. I have no problems reusing the COM port after the device has been reconnected.
Sometimes it really helps to READ the help.
Error I/O operates uniquely in this function. The function closes the device session regardless of whether an error occurred in a preceding operation. For each VISA session that you open, you should close the session when you are finished with it. This function accepts all available classes.
So, now that you have dead code and you just garunteed that incomming errors are tossed out, how will you debug your app?