LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Asynchronous execution of loops

Hi,  I'm trying to get two loops to execute asynchronously.  See the pictures attached.  I'd like the left loop to execute every .5 seconds and the right loop to execute as fast as the cpu will allow.  In my picture, both loops are limited to 500ms.  How can I decouple these loops?

 

thx

Matt

0 Kudos
Message 1 of 3
(1,265 Views)

@Matt927 wrote:

H How can I decouple these loops?


Both loops are in the same while loop, that is why they are coupled. Try separate while loops.

 

Message 2 of 3
(1,250 Views)
  • Dataflow dictates that the outer while loop cannot go to the next iteration until all parts have completed. The slowest part determines the loop rate.
  • A FOR loop with one iteration is exactly the same as no FOR loop at all!
  • Use two independent while loops and things will fall into place.
  • Always define a loop rate unless this is a quick finite loop for calculation (e.g. a newton-raphson solver). As fast as the CPU allows is silly, because whenever you change computers, the rate will be different. Even setting the wait to zero has a beneficial effect allowing a task switch.
  • displaying a ms timer value to the user is pointless. One typically subtracts the start tick for a relative time. I recommend the high resolution relative seconds instead anyway. Note that the output of the wait function gives you the same information, no separate primitive needed.

Here's something to get you started.

 

altenbach_0-1662399857443.png

 

Message 3 of 3
(1,239 Views)