LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

High priority code

Hi,

 

 I am writing a code in LabView-10, where there is a camera involved. I need it to go to a particular temperature before I should close it. If my program works fine, I have a part at the end of the code that does this job.

 

My problem is, if the program crashes for some reason (for parts that does not involve camera), or even if someone hit the stop execution button, the program stops abruptly and that part of the code is not being executed. 

 

Is there a way to make something like a "High Priority" part of a code, that will always be executed no matter how the program stops.

 

Or any other idea that can solve this problem.

 

Thanks.

0 Kudos
Message 1 of 2
(2,456 Views)

You need to actually code in proper error handling as well as handle how the application exits. If the code is crashing it is a sign of bugs in the code and the code should be robust enough to detact and handle errors. Without seeing your code it is impossible to give you any advice on how to improve it but from your description you basically have buggy code. You need to fix the bugs.

 

As for catching exit events you should detect them explicitly. NEVER allow the user to use the abort button to stop your program. It is an imediate abort and doesn't allow you to clean up. Its the equilivant of stopping your car by rnning into a wall. It will stop the car but it certainly isn't advised. You should use an explicit stop/exit button on your front panel. You can use the event structure to detect that the user has signaled a stop and then perform your normal cleanup. The event structure can also detect when the user stops the code using the X (Windows close) and again perform the necessary cleanup.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 2 of 2
(2,452 Views)