LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to link my Application "Stop" Button with the LabVIEW "Run" Button ?

Solved!
Go to solution

Problem - One of my Customers recently trialed my new LabVIEW App and asked how the stopped LabVIEW App can be re-started without clicking on the "Run" Button (Right Arrow).

 

Possible Solution - Is it possible to link my Application "Stop" Button with the LabVIEW "Run" Button ?

 

Thanks !

 

Barry

 

0 Kudos
Message 1 of 7
(4,670 Views)

No.

 

What you need to do is architect your application so that you have your own run button included so that when you hit your stop button, it doesn't actually end your program, but puts it into an idle state that waits for them to hit the start button you added.

 

Search the forums.  There have been hundreds of threads where people have asked how to either start or stop and application without using the LabVIEW toolbar.

0 Kudos
Message 2 of 7
(4,660 Views)

You need to ensure that the application cannot be stopped by catching all errors.

 

A built application that is stopped makes no sense.

It should "run when opened" and keep running until it is closed.

Use a proper state machine and use an idle state if nothing is supposed to happen.

 

(When was the last time your word processor program needed to be started from a non-running state? Right?)

 

 

NOTE added: Of course anything can be done, but it would be quite silly! :D)

 

Message 3 of 7
(4,659 Views)

Thanks to both respondents for your comments/suggestions !

 

I understand now the premise behind the Autostart.vi. Attached is my App and it would be nice to quite simply replace my "START Acquisition" Button with the "Run this VI" Button. 

 

 I did a quick integration of the Autostart.vi into my App. I was successful to build it but when executed, it did nothing. It was mentioned "Autostart.vi is just a quick draft and would need significantly more work to be even generally useable."

 

Obviously this needs more work to be done but how much ?

 

Thanks !

 

Barry

 

0 Kudos
Message 4 of 7
(4,604 Views)
Solution
Accepted by topic author biernaskieb

The big problem is in your Stop Acquistion event. You are executing the LabVIEW stop sign which is the equivalent of hitting the abort button on the toolbar.  (Check the context help on that.)  You may want to stop the acquisition, but you don't want to stop your LabVIEW program.  You need that event case to transition your state machine into an idle mode where you aren't doing any acquistion.  Then hitting the start acquisition button again transitions the state machine back into acquiring.

 

Similarly in your Exit program event, you don't want to actually exit LabVIEW there.  You want to execute any shutdown commands such as closing the com port and any of those activeX references.  Then allow that to stop the while loop.  PUt the Exit LabVIEW function outside of the loop so that once everything is cleaned up, your application can exit.  You will probably want to wrap that command up in a case structure so that if you are in the run-time enviroment, it will exit your application.  But if you are in the development environment, you don't want to cause your entire LabVIEW environment to shut down.  One other thing is that right now you actually have a race condition in the Exit event.  Will the com port close first or will LabVIEW exit.  There is no defined order of execution.

 

You may also want to have an event for the Panel Close? that way you don't accidentally short circuit your entire program by hitting the X button.  You want to catch that event, discard it.  And if you do want to actually shut down, have it trigger the Exit Program button so that you can gracefully shutdown.

Message 5 of 7
(4,591 Views)

The suggestions made make sense and should fix my problem and improve my overall Application, thanks for the constructive critisism !!!

 

Barry

 

0 Kudos
Message 6 of 7
(4,566 Views)

For the record, altenbach, that VI has provided no end of amusment for me and my coworkers.  Never once did it keep someone from going "Woah... how did?"

 

Granted, the magic dies a bit when they see the XControl, but I will say that I'm very tempted to start putting that in all of my VIs from now on, just to annoy the LabVIEW guys. 🙂

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
Message 7 of 7
(4,536 Views)