LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Closing Serial Port on Stop/Abort

Whenever my program is stopped using the abort button labview gives it does not get a chance to close the serial port, thus making other programs not able to use the serial port. Is there a way I can execute some code when stopping my program aside from making my own stop button?

Cason Clagg
SwRI
LabView 7.1, Windows XP
0 Kudos
Message 1 of 16
(4,407 Views)
The abort button is not meant to be used as anything other than a debug tool. The correct way to stop you program is to have a stop button or use the event structure to capture the application exit event. I would recomend that for the user, the toolbar not be visible at all.
0 Kudos
Message 2 of 16
(4,400 Views)
Dennis is spot on. Hide the entire tool bar from the user. The abort is a hard exit - your ports and all of your controls don't have a chance against it. Attached is a jpeg, showing a common method I use to close the ports, and do some general "housekeeping" on Exit. (I assume you are using VISA).

Message Edited by Broken Arrow on 06-27-2005 09:41 AM

Richard






0 Kudos
Message 3 of 16
(4,394 Views)
I was unaware that a housekeeping case could be made like that. Seems like there would be a way to do things on exit easily, and there it is. Thanks for the post!

Cason Clagg
SwRI
LabView 7.1, Windows XP
0 Kudos
Message 4 of 16
(4,388 Views)
It's actually easier with the event structure. If you have a stop button, in the value change event for the button, you just have to put your cleanup code. It does not have to be outside the main while loop.
0 Kudos
Message 5 of 16
(4,382 Views)
You say tomato
Richard






0 Kudos
Message 6 of 16
(4,373 Views)

You say tomato

If you've never heard that song, it doesn't make sense when you read it. 😉


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 7 of 16
(4,365 Views)
Potato.

___________________
Try to take over the world!
0 Kudos
Message 8 of 16
(4,353 Views)
Tangent.

Cason Clagg
SwRI
LabView 7.1, Windows XP
0 Kudos
Message 9 of 16
(4,347 Views)
hehe, sorry, couldn't resist.

I was ststioned in Japan for a couple years and heard that song in a Karaoke bar being sung by a couple of the local folks and they were pronouncing the "tomato" and "potato" the same. It was good for a laugh at the time.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 10 of 16
(4,339 Views)