10-02-2009 06:11 AM
Hello guys. I have been trying to solve this by a long time now...but i cant solve it....
I have my main code in labview beying executed in one timed loop of 1second.....but now i need to pulse a lazer very fast than one second...
my ideia was like executing the lazer pulse code in paralel with the main code but with a mutch faster timed loop....but when i put the second timed loop outside of the main one....it hapens that the aplication keeps runing only the faster loop and the main loop doesnt run....
I really dont know how to solve this....
many thanks
JOSE
10-02-2009 06:48 AM
10-02-2009 07:42 AM
000000001 wrote:
when i put the second timed loop outside of the main one....it hapens that the aplication keeps runing only the faster loop and the main loop doesnt run....
In addition to what was said above, your two loops may not be truly independent, and thus the second loops never runs (it's waiting on the first one to complete). Post a screen shot of how the loops are setup.
10-02-2009 08:42 AM
Hello...i solved my problem but created another one :(.....ive created two while loops, one around the main aplication and the other around the VI that represents the other part of the code that i want to run faster....but now when i have 3 stop butons and when i try to stop the program it doesnt stop...
Is there a way to conect all the stop buttons to only one?
thank you
JOSE
10-02-2009 08:51 AM

10-02-2009 08:52 AM
First, you're going to have to press the 3 stop buttons to get it to stop. (Actually, only 2 of them since 1 isn't connected to anything.)
What is happening inside the subVI that is in its own while loop? Does that have a loop inside of it that keeps it from stopping?
Why do you have a while loop with a False wired to the Continue terminal? You have shift registers on that loop, but it serves no function since there is always a value initializing the while loop. And the while loop only runs once.
10-02-2009 08:56 AM
JOSE,
your code is really difficult to read. Please do some cleanup work, your diagram should be only little larger than an average computer screen. What I have glanced so far is that your code has a lot of beginner mistakes (overuse of local variables).
For multi-loop applications, you shoul have a look at the tutorials concerning Producer-Consumer design pattern. The quick and dirty approach is to use locals (a bit contradictonary to suggest using locals here after I stated an overuse of them). The drawback will be, that you lose the latch mechanism of the button and must code it on your own (and make a big set of mistakes, using locals always attracts race conditions). Most important is that you write to your button only once, after all loops have finished spinning.
Felix
10-02-2009 09:18 AM
It may be possible to change the while loops to timed loops...in the timed loops, there is a priority setting that would let you assign a higher priority for the process you wanted to run the fastest. If you have a multicore machine, you could also suggest that the code us processor 1 for one loop and 2 for the other...
If your code needs to run all the time, then the loop is fine. If it only needs to run when something changes, you might consider using the event structure, inside the while loop. As the forum is teaching me, once you kick off one event, nothing else much happens till it finishes...
Hope this is useful.
Hummer
10-02-2009 09:24 AM
A short illustration of my post
Felix
10-02-2009 11:28 AM