01-14-2014 07:19 AM
Hello all,
The aim of this VI (which I have stripped down for the purposes of this) is to do nothing until the START button is true. Then the case structure will start and the string will be sent to MSH. I also need it such that the stop command can be sent at any time and will be sent when the STOP button is true.
At the moment though, nothing happens until START is true, then the case structure starts and the inner while loop ends. BUT, then the outer while loop restarts again and the inner one plays through again which resends the string command to MSH (an undesirable process) because the START button is still true.
Is there a way to get the start button to return to a false state once the inner while loop is completed?
(Any other solutions giving the same result would be much appreciated also!)
Solved! Go to Solution.
01-14-2014 07:26 AM - edited 01-14-2014 07:27 AM
You'll need to change the mechanical action of the button.
I also recommend you to delete the inner while loop and add a wait in the while loop.
You can also delete the flat sequence structure
01-14-2014 08:53 AM
Another solution is to have the Start be switch and place the Stop command in the False case. As mentioned above, you can remove the inner while loop and sequence and add a wait.
/Y
01-14-2014 10:46 AM - edited 01-14-2014 10:47 AM
@BBRO wrote:
The aim of this VI (which I have stripped down for the purposes of this) is to do nothing until the START button is true.
Well, your code sends a stop command immediately upon program start while consuming all CPU spinning the inner loop in parallel as fast as the computer allows. (Since there is no data dependency, the inner loop and the stop code will both execute at the same time. LabVIEW does NOT execute left to right!).
All you probably need is a simple while loop, an event structure with three cases, and all buttons in latch action.
See attached simple modification, LabVIEW 9.0.
(And please don't maximize front panel and diagram to the full screen, especially if there is not much there. We sometime want to work on other things in parallel, e.g. compose this reply!)
01-14-2014 04:57 PM
01-14-2014 05:41 PM - edited 01-14-2014 05:42 PM
Ah, sorry about that. LabVIEW base did not include the event structure until recently. (I don't think many users only have LabVIEW base....)
You can easily rewrite it as a simple polling state machine unless you have ways to upgrade to LabVIEW 2012 or 2013.
01-14-2014 06:05 PM - edited 01-14-2014 06:10 PM
altenbach wrote:You can easily rewrite it as a simple polling state machine ...
Here is a quick draft for that. Modify as needed.
01-15-2014 02:04 AM
Thanks again, as a bit of a labview novice I appreciate all the help!