07-19-2021 02:57 PM
I have a complex program that uses a times loop to call other program. I have reduced the problem to a simplified example. The calling program has two examples: Selecting the broken example shows how the program hangs. Selecting (not selecting broken) shows how the program emulates a times loop and calls the underlaying VI successfully. When successful, the counter on the main program increments. When hung, nothing happens.
The program called does two things:
It initializes as event structure inside a while loop, waits for the initialization, calls the event structure with a trigger, which exits the while loop and returns to the main program. I should emphasize again that this simple program is to illustrate the bug (or my lack of understanding of timed structures). The real program is more complex but shows the same behavior.
Then called from the main program with the timed loop, the flag is never set and the other parallel tread waits causing the hang. This only happens with a timed loop as the calling entity as the other instance works fine as well as running the VI alone. You can fix this version by placing the flag outside of the timeout event structure. This will fix this bug BUT in a more complex program, that fix fails. I also included the fixed version for a comparison.
For some reason, the timed loop never initializes the called event structure. It is as if the timed loop priority takes precedence over the called program (I tried modifying that value but more bugs occurred).
Any ideas? I emulated the timed loop in similar ways to the working case (false case in calling program - yes I should have named them working and broken rather than true and false) and can go on with the larger program but I would like to understand this bug as it may illustrate my lack of understanding of timed loops or something for NI to explore.
I am using LV19.1.
.
Solved! Go to Solution.
07-19-2021 03:33 PM - edited 07-19-2021 03:34 PM
Well Timed Loops are really for use with LabVIEW-RT and and the FPGA module.
While you may use a Timed Loop Structure on a non-RT system, most often it will not solve any problems better then a simple while loop with a wait inside…
Describe in detail what exactly you are trying to do here and we might be able to give you a better approach than misusing a Timed Loop structure.
07-20-2021 12:28 PM
No, No, Nooooo!
I think at this point, the timed loop is the least of your problems. Start with some basic tutorial (e.g. listed at the top of the forum), then tell us what you want to do, now how you want to do it.
07-20-2021 02:10 PM
Thanks for the programing critique. I will take it under advisement.
You can remove many of the loops, if you want. I use them to illustrate a given point
However, what I want to do is understand why the timing loop breaks the calling program.
Run it and see, As to the other concerns, we can address them later.
07-20-2021 02:14 PM - edited 07-20-2021 02:16 PM
@dkidw2010 wrote:
Thanks for the programing critique. I will take it under advisement.
You can remove many of the loops, if you want. I use them to illustrate a given point
However, what I want to do is understand why the timing loop breaks the calling program.
Run it and see, As to the other concerns, we can address them later.
The only point I see illustrated here is: A poorly written program performs poorly.
And that's a given, trust me I have made this point a million times myself.