LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stop button to set digital I/Os to zero

     Hi.  I'm trying to figure out how to make an emergency stop button for my VI.  If I click the "Abort Execution" button while my VI is sending an output voltage, the voltage continues to be sent out until I clear it with another program I made that sets all digital I/Os to zero.  This is not good, because this particular output is sent to a $1000 motor that I am testing to see if it can go up in a satellite, and I don't want to break it.  Can someone please help me?

     I've tried many different combinations of event structures, case structures, and local variables, and none of them have worked for me.  From what I can gather, it seems the only way to create a button that will end my VI is if I put the entire VI into a while loop and to have the stop button hooked up to the "Stop If True" box.

     Also, I don't know if this makes a difference, but I want the loop to either only run once, or stop if I press the Emergency Stop button on the front panel.  I just figured that I could set up a comparison test to see if the loop had run more than once, and then to connect that to an "Or" test to see if either the stop button was pressed, or the loop had completed one iteration.

     I'm using a PMD-1608FS digital/analog I/O device.

 

Thanks very much for any help you can give.

 

-Billy Madison

 

P.S. For those of you who think this is an easy problem, and that I sound like a noob, that's because I am.  I taught myself how to use LabVIEW a week ago, from reading the book: "LabVIEW for Everyone."  (By the way, this book did not have very good examples.  It was only an 'okay' book for describing the theory of using different tools in LabVIEW).  My problem is that I only have a few more days at my job before I go back to school.  I want to help them get as far as I can before I leave, so that they will have me back for the summer.

0 Kudos
Message 1 of 6
(3,771 Views)

Billy Madison wrote:

...  From what I can gather, it seems the only way to create a button that will end my VI is if I put the entire VI into a while loop and to have the stop button hooked up to the "Stop If True" box.

...

-Billy Madison

 

...By the way, this book did not have very good examples.  ...


That is the answer (well almost) !

 

After (use a wire to enusre it executes after the While Loop) your While loop completes execute the required operation to set all of the outputs to a safe condition.

 

Watch your code in execution highlighting mode and you should see teh loop terminate and then execute the clean-up work.

 

Ben

 

PS By the way, I will not tell Jim about the examples. Smiley Wink

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 6
(3,761 Views)

Billy:

 

Was the suggestion I posted to your original post linked below applicable to your situation?

 

http://forums.ni.com/ni/board/message?board.id=BreakPoint&thread.id=7083

 

-Ak2DM

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 3 of 6
(3,756 Views)

Ben

 

That sounds similar to what I was just trying.  My problem was that I was using a local variable readout to stop the VI, and the local variable value is based on a case structure that is true if the stop button is pressed.  Also, I read somewhere else that I have to put the stop button inside the smallest while loop, or else the computer won't be able to test whether or not I pressed the stop button until after the small loop ends.  (It is during this small loop that I would need to stop the program).

 

You said: "use a wire to enusre [the operation] executes after the While Loop."

 

     -Where would I attach this wire?

 

Thanks again,

 

Billy Madison

 

P.S. I left out some of the specifics when I wrote the message because I was afraid it would complicate things too much.  You seem to know what you're talking about though, so I'm attaching my VI.  Maybe you could give more of a visual answer? (It may be a little messy, since the last 2 days I've been messing around with it, but it mostly goes from left to right).

 

P.P.S. Thanks for not letting Mr. Kring know what I said.  You know it's funny; one of my co-workers is also friends with Jim Kring.  In fact, the copy of the book I borrowed is his, and it happened to be a gift from Mr. Kring.

0 Kudos
Message 4 of 6
(3,742 Views)

Billy Madison wrote:

...

 

P.P.S. Thanks for not letting Mr. Kring know what I said.  You know it's funny; one of my co-workers is also friends with Jim Kring.  In fact, the copy of the book I borrowed is his, and it happened to be a gift from Mr. Kring.


OK I will not tell Jim as long you don't tell anyone that I posted this message without lecturing about style etc. (Since you are headed back to school you will not have time to learn that stuff and still get your app

 fixed).

 

I'd try this

 

 

A) I'm gueesing this is the code that stops the motor.

 

B) The wire will ensure the while loop is finished before the final sequence frame executes.

 

Again, watch it in highlighting mode to see the data flow paradigm at work.

 

Ben

Message Edited by Ben on 01-15-2009 02:30 PM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 6
(3,736 Views)

Ben,

 

Thanks for the tip, but i'm still unable to even run the VI with local variables.  I got rid of them to run it but then the VI didn't take notice to my pressing the stop button.  Also, I thought that with the way I set up my "equal?" comparison test and my "or" boolean, that the VI would end if either the stop button was pressed or the subcode finished running through one time.  Do you think you could help me with this? With this, the code should run perfectly.

 

Billy

 

P. S. The new code is attached.

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