LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hardware not reseting on close !?

When I click my shutdown button it runs a reset to default command and then a two button dialog asking if you want to shut down and then exits.

 

The reset to default works as needed when it has its own button.  But when I make it also activate the exit dialog it will reset the panel but not the hardware.

If I select no on the dialog box it will reset the hardware.  Then I can click shutdown again and select yes.

 

The hardware is a USB-6001 controlling some relays using the digital outs.

Labview 2013 service pack one.

 

My vi is set to stop intsead of exit for the development phase.  Also my step commands are not progamed as this step is not finished.

program.PNG

active panel.PNG

0 Kudos
Message 1 of 6
(3,417 Views)
As mentioned numerous times, using the stop function is like stopping your car by running into a tree. Do NOT use that! You stop the loop by its termination terminal.
0 Kudos
Message 2 of 6
(3,399 Views)

Do a search here for state machine architecture and learn how to correctly do this type of program control.  The STOP VI is the same as pressing the abort button and should not be used except for very rare circumstances.  Read the help on it.  It does not shut down anything properly.  A common phrase around here is: " Using the abort button (or STOP VI) is like crashing into a tree to stop your car, it works, but there are far better ways to go about it." Smiley Wink

 

EDIT: I told you that phrase was popular! Smiley Very Happy

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 3 of 6
(3,395 Views)

@RedneckNerd wrote:

When I click my shutdown button it runs a reset to default command and then a two button dialog asking if you want to shut down and then exits.

 

The reset to default works as needed when it has its own button.  But when I make it also activate the exit dialog it will reset the panel but not the hardware.

If I select no on the dialog box it will reset the hardware.  Then I can click shutdown again and select yes.

 

The hardware is a USB-6001 controlling some relays using the digital outs.

Labview 2013 service pack one.

 

My vi is set to stop intsead of exit for the development phase.  Also my step commands are not progamed as this step is not finished.

 


You should take about 10 steps backwards before trying to move forward.

 

It shouldn't be reseting the hardware.  The defaults are for the panel and nothing else.  That's ALL it resets.  When you wire "This VI" as an input, you should expect it to modify "This VI" rather than "This VI and any connected hardware."  The two aren't the same.

 

Why is your shutdown button set as a switch?  You're fortunate that the "reset all to defaults" has the side effect of changing it back to false.  But, this is a bad practice.  What you want to use is a latch when released mechanical action. 

 

You are trying to implement a state machine, as others have suggested.  But, you need to understand the architecture a bit better before actually putting it into code.

 

If you want a clean shutdown, program one.  Don't ever use that stop sign. You're telling the code to exit immediately.  Why be surprised that it does as you tell it rather than taking time to shutdown cleanly?

0 Kudos
Message 4 of 6
(3,388 Views)
For what you've shown, a simple event structure can be used. It's silly to keep hammering the DAQ device when you only need to write when a control changes.
0 Kudos
Message 5 of 6
(3,378 Views)

First off, thanks for tolerating a newb who hasn't been allowed to go through class yet and hasn't made it throught all the tutorials due to the expectations at work.

Thanks for all the informative input. 

 

I will learn about state machines.

Also I didn't think about event structures for the outputs.  I will implement that. 

 

Also thank you for informing me about the stop function.  I will need to keep that in mind for future projects and go back and change some old ones!

 

But on a positive note I don't have any of the evil purple lines!

 

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