06-29-2012 01:22 AM
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
Solved! Go to Solution.
06-29-2012 01:49 AM
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.
06-29-2012 02:27 AM
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.
06-29-2012 03:22 AM
@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)
06-29-2012 06:13 AM
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!!
06-29-2012 06:18 AM
The last value you write to the AO and that is put out should be 0 😉
06-29-2012 06:52 AM - edited 06-29-2012 06:53 AM
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
06-29-2012 10:00 AM
That worked, thank you very much!!
06-29-2012 05:11 PM
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.