Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Reconfigure VISA Serial Port after error detected

Solved!
Go to solution

Hello,

 

I'm communicating with a watlow f4 with a rs232-> USB conversion cable

I'm using the VISA Configure Serial Port to create my base of communication with the watlow.

 

My program is working fine and doing what it needs to in terms of execution, but I'm trying stump out the last of my "what if X problem occurs while program is running"

 

Right now, the X (problem) i'm trying to resolve is

 

"what happens if someone accidently unplugs the watlow USB plug from the back of the PC that the application is running on?"

 

For now, I do have it sensing such an error, but I'm basically telling the user that the program will have to be restarted.

 

I would like to pause the program when this error has been detected (which I know how to do) and tell the user "please plug-in the serial COM USB back into the PC, select the COM port from the drop down list and press OK to resume program" (this is the part I can't figure out how to do)

 

How can I  reset and re-initialize the VISA serial port after my program detects this error?

 

0 Kudos
Message 1 of 6
(3,289 Views)
Solution
Accepted by topic author Bpatel

What I have done is perform a scan every X seconds for new serial ports and populate a ring with that list (use VISA Find Resource).  Once the user presses the OK button, just reinitialize the port like you did at the start of the program.


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 6
(3,269 Views)

Ok I can try that

How do I convert that visa find resource output string into the ring and than convert that selected port from the ring into a unique reference for the visa i/o session?

0 Kudos
Message 3 of 6
(3,266 Views)

i just realized I can use strings to input as the visa resource name for the "configure visa serial port.vi" ... thanks again , i'll try it on my own and see what happens!

0 Kudos
Message 4 of 6
(3,264 Views)

Let me address this a different way.

 

Why would you allow physical access to the USB connections?  There are no "Accidentally" disconnected cables in a proper environment.  What you have is a location that is inherently UNSAFE!  Worse, no-one is paying enough attention to even notice that the environment is placing equipment and personnel at risk of harm.

 

Given that situation, I personally, would be more concerned about updating my resume than my code.


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

While I agree that having the USB accessibly in unsafe ways is bad...its just that way by default due to the circumstances of the surrounding environment

 

my setup is on multiple rolling carts that are basically my test stands for technicians to use. 

these carts roll around to different thermal/environmental chambers depending on the needs..the USB for my watlow communication is plugged into the back of the test stand PC..if the test stand cart was stationary and never ever moved, I could build a more safe environment to house my com connections. 

 

but since I do have to move around the test stands and plug them into different chambers(thus, a different watlow), these USB connections do have to be unplugged from time to time. 

 

0 Kudos
Message 6 of 6
(3,239 Views)