LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waiting time for two while loops in sequence

Hi, 

I need help to set up a timer for each while loop (there are two loops in sequence). The first while loop needs to run during x min, and then go to the next while loop and run x minutes, and then this process continues until a certain number of interactions. 

The problem is that in my VI, the first while loop is runing the right time in the first interaction, but then in the nexts ones its runing just for 6 seconds, not the correct time that I set up.

I am new with labview, and maybe it can be easliy solved, but I do not know why it is not working properly.

Could someone help me?

0 Kudos
Message 1 of 4
(648 Views)

Make sure you Reset the Elapsed time, typically with a "=0" -block from the loops Iteration counter to the Reset.

You don't need the sequence structure as they're limited by the wires, the 2nd loop can't run until the 1st finishes.

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 4
(643 Views)

Hi juju,

 


@jujuhscastro wrote:

I need help to set up a timer for each while loop (there are two loops in sequence). The first while loop needs to run during x min, and then go to the next while loop and run x minutes, and then this process continues until a certain number of interactions. 


You don't need a sequence, you don't need two while loops!

All you need is a (simple) state machine…

 

See this:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 4
(628 Views)

The Flat Sequence structure should be avoided at all costs.

 

This program should be a Simple State Machine architecture.

 

That would allow you to reuse %99 of your code in the two loops and be far simpler to scale in the future.

 

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 4
(559 Views)