LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pausing a FOR loop

Hello
 
I am currently creating a data logger for a sruge machine we use in our motor shop.  The tester is used to test DC armatures and the test is repeated N number of times.  The way I would like to control my program is to have it pause after each loop, allow the user to reset the test gear and then collect the data again.  Right now I am accomplishing this using a For loop with a "Wait for Front Panel Activity", however if a user were to push a button 2 times it will run through the loop twice.  It is almost like the "Wait for front panel activity" creates a que.  I tried putting everything inside the FOR loop in a sequence to try and aviod this but it doesnt seem to help.
 
I am attaching the code. 
Any tips would be appreciated.
 
Thanks
Trent
0 Kudos
Message 1 of 5
(3,027 Views)
Instead of a wait for front panel activity, end each iteration of the for loop with a "popup dialogue", this is a modal subiv.  This subvi can have some complex logic if you desire, like do until "OK" Boolean is pressed or a timeout occurred (event structure will allow for many possibilities).  The modal setting will force the user to deal with the popup.
 
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 2 of 5
(3,018 Views)

You can also have a continue button/ Boolean which will be visible after the loop and will wait until true to continue.  This is a state-machine approach. Inside the for loop state 1 is initialize/ hide continue button, state 2 is run test, state 3 is show continue button state4 is wait for user to acknowledge that the test is ready to repeat.  Do this N times or until done.

 

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 3 of 5
(3,014 Views)
do you have some more information on the state machine?
0 Kudos
Message 4 of 5
(3,011 Views)
In LV 7.0, the state machine is a design pattern (and probably the most powerful pattern for ATE) in LV 7.1 there is even a state diagram toolkit which will help code the states for you.  Essentially a state machine is a while loop with shift register holding a state (often an enumerated type),  the states are placed in a case structure and the output of a state is the next state to execute, unless it is the terminating state which is passed to the condition of the loop, ie while (state != terminal state).  The shift register is initialized with the initial state.  This is a really nice method for controlling a sequence of events specially in a data-flow program such as labview.  It also allows for easy initialization and safe shutdown of your test and will handle errors with ease.  You can replace any sequence with a state machine and gain the flexibility of out of order sequencing, which is not possible with static sequence structures.  I also think the state machine promotes good modularity of code.
 
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 5 of 5
(3,008 Views)