LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Break out of a While Loop then jump back in (to re-initialize a shift register)

I'm initializing a shift register with default 0 when the program fires up. The shift register indexes an array which caries out automated functions. The user may want to stop what's happening, then resume at some other point (such as stop at step 7 then resume later at step 5), so I have to initialize the shift register to another number (right?). An "easy" way (I thought) would be to break out of the While Loop, let the program read the new scaler input to the shift register, then jump back in the loop. I'm having trouble with this. How do I break out and jump back in? (6.0.2)
thanks as always!
Richard






0 Kudos
Message 1 of 4
(3,016 Views)
Arrow;

That also look like a state machine. You may want to do a search on "state machine" here at Developer Zone or at NI website. Here are some good discussions:

(What is a) state machine

Help with a state machine

I hope this can help you with your problem.

Regards;
Enrique
www.vartortech.com
0 Kudos
Message 2 of 4
(3,016 Views)
The best way to implement this, I think, would be to use a state machinge architecture. There is an example with 6.0.2 under Advanced>User Interface Development>User Interface Events. Essentially, what a LabVIEW state machine is a while loop with a shift register that is connected to the selector of a case statement. Inside of each case statement, you can define the next state to execute. The example uses a queue but it can also be done with enums or simple strings. If you searched the forum's archives on state machines, you'd find a lot of discussions on the pros and cons of the best way to implement one. The LabVIEW Technical Resource (www.ltrpub.com) also had an excellent article on queue driven state machines last year. Good luck.
Message 3 of 4
(3,016 Views)
You can add an extra while loop so the user can pause the application and restart it. See attachement.

I hope it will be helpful.

Have a nice day.
Message 4 of 4
(3,016 Views)