LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

abort button and open references

I'm about to debug a vi which reads from files. While debugging I'm forced to use the abort button.

 

My question: What happens with open references (for example file references) when I use the abort button? I they stay open: Is there a way to close them after the abort button was used?

0 Kudos
Message 1 of 5
(2,553 Views)

Depends a bit on the reference type. For example in the Settings of LabVIEW (Settings > Environment > Automatically close VISA sessions) you can handle the automatically closing of VISA connections. However, sometimes files stay locked for LabVIEW, but the reference cannot be used after the abort button. For the IMAQ you can for example say to dispose all images from the memory, I think even the references from a previous run. 

 

I don't know a way of closing files after using the Abort function. Perhaps we can help you to make you debug the code without using the abort button?

0 Kudos
Message 2 of 5
(2,541 Views)

A VI forcing you to use the Abort button should be scrapped. Period.

 

That being said, Harlequinade already told the essential information on this question: It all depends on the reference type. LV abstracts a lot of programming effort from the user, which can include reference handling. So LV in general will release all references at least once it is closed.

BUT: I have seen references, which would still block until you reboot the whole system.


Adding potential hardware issues (e.g. motion control keeps moving) when pressing the abort button makes this an absolute no-go for 99.9999999% of all cases where it is used. The most prominent issue i heard of was a hardware defect caused by a motion system going wild because the abort button was pressed. It was a severe damage and not speaking about additional time spending to fix it......

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 3 of 5
(2,523 Views)

Put a separate While loop in your code that reads a Stop button that you place on your front panel.  The loop should have a 100mS delay inside of it.  Wire the stop button to the loop stop sign.  No other wires into the loop.  Have an output from the loop (you can use the stop button wired to the loop edge) wired to some code that will gracefully shut down your application (close references, turn off power, etc.)  Use the Stop function found in the Applications palette at the very end of your graceful shutdown routine.  Then instead of pressing the Abort button, you press your Stop button and the VI will stop even if it is not finished executing other sections of the code.  See attached VI (LV2012) for an example.

 

When finished debugging, and ready to release your code, you can delete the abort code.

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 5
(2,499 Views)

Thank you guys. With your three answers, things are clearer; I like especially your tirck, tbob.

0 Kudos
Message 5 of 5
(2,443 Views)