LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Set all controls and indicators to zero just before aborting execution

Hello, 

I want to set all controls and indicators to zero just before aborting execution.

Regards,

0 Kudos
Message 1 of 9
(3,536 Views)

You can use the 'Reinitialize to default' method of the VI class.

 

reinitdflt.png

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 9
(3,529 Views)

Hi idir,

 

I want to set all controls and indicators to zero just before aborting execution.

What's the point in doing so?

(Most often you want to reinit controls at startup of your VI…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 9
(3,520 Views)

How do you know when you are aborting your program?

Normally I stop or exit an application, never abort.

0 Kudos
Message 4 of 9
(3,509 Views)

I don't understand why you would need to do this.  Perhaps if you shared the reason why you want to do this, we might be able to suggest a better way to accomplish it...  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 9
(3,472 Views)

Because I am controlling a voltage using labview. I want the voltage going back to zero when the user stops the vi.

 

0 Kudos
Message 6 of 9
(3,456 Views)

Hi idir,

 

why do you want to set controls to zero - instead of setting the voltage output to zero???

(Why do you need to clear indicators too?)

Using a proper state machine might help, but even a simple DAQmxWrite after your main loop could be sufficient...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 9
(3,450 Views)

Don't allow the VI to be aborted. Code cannot predict when an abort will happen, and once the VI is aborted, it is too late to do something about it.

 

Create a conditional event for "panel close?", discard it, and initiate the shutdown code instead. After this has completed, have the VI stop itself normally by simply running out of code. 😄 Let us know if you need help with that. Maybe show us your code.

0 Kudos
Message 8 of 9
(3,441 Views)

Share the VI/Code Snippet for better suggestions,

 

Aborting an Application will end up in Problem mainly when interfacing with hardware so to make hardware idle. Handle the Shutdown case properly (As Suggested by others) by Setting the voltage level as expected before quieting the application.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 9 of 9
(3,415 Views)