LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reset one while loop and keep the other running

I am looking to run two while loops and reset one if needed. In my attached file I want to reset while loop 1 and the 'get date time'  and keep while loop 2 going. Any suggestions of how to do this?

0 Kudos
Message 1 of 6
(2,888 Views)

You mean like this:

 

snippet.png

http://www.medicollector.com
0 Kudos
Message 2 of 6
(2,882 Views)

I'd recommend just putting a select statement in the loop with a reset button.  Store the original timestamp in a shift register.  In the loop, if the Reset button is true, put the new timestamp on the shift register, otherwise put the current value in the shift register back in.

0 Kudos
Message 3 of 6
(2,880 Views)

The problem with the approaches that are being recommended is that while they will work right now they don't scale very well. Use an event structure and have a reset event that re-does everything that might need to be reset in the application. The event itself could be a value change event of a button, or a user-defined event, doesn't matter, either would work. Now any place that might need to reset the program only has to tug on that event to do the reset.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 4 of 6
(2,872 Views)

@Relient wrote:

I am looking to run two while loops and reset one if needed. In my attached file I want to reset while loop 1 and the 'get date time'  and keep while loop 2 going. Any suggestions of how to do this?



What is the meaning of "reset a loop"? You probably want to reset the timer, which is completely something else. You code makes no sense! Having two loop spinning like crazy, consuming all the CPU they can get, with nothing to show for it later.

 

Can we take a step back and start with your requirements as seen from the operator point of view. What should the program do? How is it operated during run? What should it display? How should it react to user inputs? When should it all end?

 

I am with Mike here. Most likely all you need is a single loop and a proper state machine code architecture.

0 Kudos
Message 5 of 6
(2,866 Views)

Apart from the need of a Wait in both loops, place a Reset button in loop one and connect to a Case, if True, send out a new Time, if false use the old. Feed time to a shift register to get a new start time.

 

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 6
(2,858 Views)