annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

Flat sequence in a while loop

Risolto!
Vai alla soluzione

Hello,

 

I am pretty new to labview. I am using a flat sequence inside a while loop. there are 2 sequence. the first sequence will have wait time for 3 sec and next sequence will have wait time for 7 sec. Now I have attached a stop control button. Now when i run the vi, and let say i want to stop the program using the stop button for while loop, i cannot stop the vi.

how do i make a control to stop the program at anytime??

0 Kudos
Messaggio 1 di 6
3.924Visualizzazioni
Soluzione
Accettato da Sid1007

Hi Sid,

 

to stop immediately you need to get rid of those long wait times.

A state machine may help...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Messaggio 2 di 6
3.898Visualizzazioni
Soluzione
Accettato da Sid1007

As GerdW said, a state machine is an appropriate approach. You only need one loop, and the state machine does the sequencing (no sequence structure). You use small wait times and exit the wait state when you reach your total wait time.

0 Kudos
Messaggio 3 di 6
3.881Visualizzazioni
Soluzione
Accettato da Sid1007

A sequence works similar to a sub-vi in that nothing can happen until it's finished. So your stop button probably works, but it'll wait the 10 secs (or <=20 if it reads the stop button at a bad time) Before it stops.

As mentioned, a state machine is a good solution to these needs.

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Messaggio 4 di 6
3.832Visualizzazioni

Since you are "pretty new" to LabVIEW, I would immediately ditch the use of sequence structures, and learn how to enforce dataflow correctly.  Here is a link to help you get started.  Depending on sequence structures to enforce dataflow is a habit you have to immediately unlearn.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Messaggio 5 di 6
3.787Visualizzazioni

Thank you everybody. The used state machine and it works fine very efficient. 

Messaggio 6 di 6
3.754Visualizzazioni