LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement single and continuous run?

Solved!
Go to solution

 

Hi All:

 

I add two controls on front panel, a "single" button, and a "continuous " one.

 

When "single" is pressed, the sub VI will execute only once.

 

But when "continuous" is pressed, the sub VI will execute continously.

 

 

 

I think I can use a while event structure , which captures the button events,

 

for "single button clicked event ", I just put sub VI  into the diagram.

 

 

For "continuous" condition, I will circle the sub VI with a while loop, inside the event diagram.

 

But now the problem is :  how should I wire the stop button for this while loop?

 

I think it should stop as soon as "single " button clicked, because now I am going to switch to "single" state.

 

 

Maybe I should wire the single button to the stop button? 

 

 

 

Do you have other solutions?

Any suggestions will be greatly appreciated. Many thanks.

 

 

 

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

 can post your vi or the snippet of what you are doing

0 Kudos
Message 2 of 8
(3,587 Views)

without seeing what you have got. remember a while loop always executes at least once. use you single/continuous boolean control wired straight to the stop terminal of the while loop.

 

As asked for though will be easier to answer if we can see the code

 

hope it helps though

Please remember to accept any solutions and give kudos, Thanks


LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7
Message 3 of 8
(3,582 Views)

Hi Julia,

 

Please have a look on this VI.

 

I think this will resolve your query.

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
Message 4 of 8
(3,579 Views)

@Julia2013 wrote:

  

I add two controls on front panel, a "single" button, and a "continuous " one.

 

Any suggestions will be greatly appreciated. Many thanks.


Why to add two controls, rather keep single 'Toggle' switch:

 

Single button.png


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


Message 5 of 8
(3,571 Views)

i was suggesting link this mode control to the stop in the while loop

Please remember to accept any solutions and give kudos, Thanks


LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7
0 Kudos
Message 6 of 8
(3,569 Views)

Hi All:

 

I am really grateful to so many people helping! Thank you all. I will give kudos as I look into more details.:)

 

 

Attached are two VIs.           subVI is "LED blink once.vi"

 

I want to make the LED blink once, when single button is clicked.

And it blinks continously when continuous button clicked.

 

For the continuous event, I use one more while -event structure,

 

where I put the subVI inside its "timeout" event, while pass "true" to stop this while loop inside "single mouse down" event.

 

 

But the VI runs with problems.

As soon as it run, after I clicked the "single" button once, I can no more click on any other buttons such as continous or stop!

The same problems with the other two buttons.

Seems I can only click on one button as soon as it starts to run, all other buttons failed to respond.

 

Why ?

Download All
0 Kudos
Message 7 of 8
(3,536 Views)
Solution
Accepted by topic author Julia2013

First of all, I highly recommend using the Value Change event instead of the Mouse Down.

 

Secondly, you shouldn't have an event structure inside of an event structure.  In general, you should have 1 event structure in a VI.  The reason is because there are many caveats of the event structure, and just using 1 of them alleviates most of those.

 

What you really want here is a version of the Master/Slave architecture.  You have 1 loop for handling the events and another loop to control your blinking.  You can use a notifier to communicate between the loops.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 8
(3,513 Views)