LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting button to change automatically after case structure is completed once.

Solved!
Go to solution

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!) 

0 Kudos
Message 1 of 8
(3,576 Views)

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

latch.PNG

---

UnCertified LabVIEW Student
Mistakes are for learning, that's why suggestions are always welcome!
0 Kudos
Message 2 of 8
(3,572 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 8
(3,551 Views)
Solution
Accepted by topic author BBRO

@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!)

0 Kudos
Message 4 of 8
(3,535 Views)
Thanks altenbach, that's exactly what I was tying to achieve.
Do you know which versions of labview have event structures in the palette, I'm running labview 2009 basic and can't find them (I tried using the help file to direct me but there was an error saying it couldn't be found in the palette)?
0 Kudos
Message 5 of 8
(3,493 Views)

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.

0 Kudos
Message 6 of 8
(3,477 Views)

altenbach wrote:

You can easily rewrite it as a simple polling state machine ...


Here is a quick draft for that. Modify as needed.

0 Kudos
Message 7 of 8
(3,464 Views)

Thanks again, as a bit of a labview novice I appreciate all the help!

0 Kudos
Message 8 of 8
(3,434 Views)