LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to reset a slide control when stopping the VI

Solved!
Go to solution

Hi everybody,

 

Hope anyone can help me out with this question (I´m very new to LabView):

 

I have a loop to control the speed (exactly the turning moment) of a Motor. Simply a analog output of a DAQ-device is connected to the motor controller. If I run the VI and set for example a speed of 50 % (= 5 V Analog out) and I close the VI, the DAQ device still holds this value for endless time. How can I reset the slide control to "0" when stopping/closing the VI that my motor stops?

 

By the way a "stupid" qestion: What is the common way to stop a VI? Should there be a "cancel" button which stops all loops or should that be done with the Labview menue "stop"?

 

Thank you for your replies!!!

 

Markus

0 Kudos
Message 1 of 9
(4,128 Views)

Right click on the control and select "Create->Invoke Node->Reinitialize to Default". Place this invoke node at the appropriate place where you want to set the value to the default. Alternatively you can create a local variable of the control and wire a 0 to it. Again, place this at the correct place in your code.



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
0 Kudos
Message 2 of 9
(4,120 Views)

Someone here wrote correctly, that stopping a vi with the menu stop button (or window close) is like stopping a car by throwing a tree on the road. The car will stop, but the consequences could be unexpected 😉

 

Place a stop button on the front panel and wire a defined 'roll out' (ramp down, etc) 

Event better is an event structure that captures menu stop and window close events and proceed like the FP stop button.

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


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

@Henrik Volkers wrote:

Someone here wrote correctly, that stopping a vi with the menu stop button (or window close) is like stopping a car by throwing a tree on the road. The car will stop, but the consequences could be unexpected 😉

 

 

Its non other than @Ben. Yes its like "using the Abort button is like stopping the car by hitting a tree you will be able to stop but the results will be different" (something like this)

-----

The best solution is the one you find it by yourself
Message 4 of 9
(4,106 Views)

thanx for your replies!

 

@Mark_Yedniak

I created a Invoke node "Reinitialize to Default" and plaxed it in the loop. The result is, that when exiting the VI with the cancel button, the slide control correctly is resetted to "0". But the DAQ-device still holds the "last" value. The analog output is NOT zero and the motor still runs.... is the reason that the VI is ended before the DAQ-assistant "recognizez" it should also "reinitializize to default"? What did I do wrong?

 

Thanx again!!

Download All
0 Kudos
Message 5 of 9
(4,090 Views)

The last value you write to the AO and that is put out should be 0 😉

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 6 of 9
(4,082 Views)
Solution
Accepted by topic author WhiteCloud

You need to control your data flow.

 

You could do something like the attached example - does this solves your problem?

(You need to setup your DAQ assistant again, as I changed it)

 

We have a lot of free online training in LabVIEW.

http://digital.ni.com/src.nsf/ttitle?OpenView&node=203014_us

 

3 hours course:

http://www.ni.com/white-paper/5243/en

 

6 hours course:

http://www.ni.com/white-paper/5241/en

Best Regards

Alex E. Munkhaus
Certified LabVIEW Developer (CLD)
System Engineer
0 Kudos
Message 7 of 9
(4,062 Views)

That worked, thank you very much!!

 

0 Kudos
Message 8 of 9
(4,044 Views)

Why not mark the post of the solution you used as th eactual solution. Marking your thank you does not give credit to the person who solved your issue as well as it does not identify what the actual solution is.



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 9 of 9
(4,025 Views)