annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

How can I stop and restart a .vi with a single front panel button?

Risolto!
Vai alla soluzione

Hey guys, a newbie here.

 

I have a .vi with a stacked sequence. The first few frames are hardware initialization and settings (LIN master node) and the data the hardware should transmit (frame response table). In the next frame there's a loop in which the hardware sends and recieves data (LIN monitor). If I want to change the initialization, settings or data values, I have to stop the .vi and restart it. I was wondering if there is a simple way of doing this with a single click (a button on the front panel).

 

An alternative would be to put another loop outiside the whole stacked sequence and then run it a single time with a push of a button (the inner loop should let the outer one restart), is that possible?

 

I hope I made any sense. Thanks for any suggestions.

Tomaz

0 Kudos
Messaggio 1 di 11
9.421Visualizzazioni

Hi,

 Can you post your vi?

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Messaggio 2 di 11
9.410Visualizzazioni

It has about 100 custom subVIs, I don't think posting it would be of much use. Basically, the vi goes like this:

 

stacked sequence: do A -> do B -> do loop until "stop".

 

I'd like a way to start again from the beginning of the sequence ("do A") without stopping and restarting the VI (or doing this with a single button).

0 Kudos
Messaggio 3 di 11
9.400Visualizzazioni
Sounds like you need a State Machine.  It's pretty easy to implement.
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Messaggio 4 di 11
9.395Visualizzazioni
Do what Jim suggested and try to work with a State Machine; you can find a template at File -> New.. and in Design Patterns, you should be able to find the Standard State Machine template. Try to work with it and post your test VI if you get stuck somewhere.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
Messaggio 5 di 11
9.381Visualizzazioni

Tomaz79 wrote:

 

I'd like a way to start again from the beginning of the sequence ....


Take the great advice given. Think of a State Machine as LabVIEW's only way to do a GoTo statement, or even a GoSub statement with a Return.

Richard






Messaggio 6 di 11
9.369Visualizzazioni
Soluzione
Accettato da Tomaz79
Ideally, redoing the code with a state machine would be the best way to go, if only so that you can add this powerful tool to your toolbox. That being said, wrapping your existing code in a while loop, with its own stop button to stop the program, will work if executing the entire sequence is ok. Where you might run into problems with this is if there is a step in the sequence that shouldn't be executed again, then it would require wrapping that sequence frame's code in a case statement that executes only the first time through. If you have the time, learning how to use a state machine would be a real benefit, really taking your LabVIEW knowledge to the next step, if you pardon the pun.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Messaggio 7 di 11
9.366Visualizzazioni

Thanks for the suggestions, I'll try it and report back.

 

Tomaž

0 Kudos
Messaggio 8 di 11
9.352Visualizzazioni

It turned out that wrapping everything in a while loop was all I needed for this case. I also learned how to use a state machine so thanks to all of you guys for the help!

 

Tomaž

0 Kudos
Messaggio 9 di 11
9.297Visualizzazioni

hi guys this my vi file how should i stop and restart the program 

Scarica tutti
0 Kudos
Messaggio 10 di 11
5.571Visualizzazioni