11-01-2023 05:07 AM
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?
11-01-2023 05:24 AM
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.
11-01-2023 05:36 AM - edited 11-01-2023 05:38 AM
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:
11-01-2023 03:07 PM - edited 11-01-2023 03:07 PM
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.