LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I synchronize parallel while loops?

Solved!
Go to solution
I was wondering how can I synchronize the execution of my while loops? I already implemented the parallel connection of error cluster in the two loops but still the code executes either one of the loop first before the other. how can i eliminate the delay in between the loops?
 
labview - pulse generator
 
Attached here in my post is the copy of my code.
0 Kudos
Message 1 of 6
(14,424 Views)
Hi ralvarez,

The conntinous acquisition part runs parallel in your code - every while loop runs in a separate thread provided that you don't implement dependencies (maybe your Pulse generation VI isn't set to reentrant? --> attention: Raise conditions) of the two loops.

HTH

--
Joachim


Message Edited by Joachim082 on 05-14-2008 07:08 AM
0 Kudos
Message 2 of 6
(14,420 Views)
Two DAQmx Tasks accessing the same resources cannot run in parallel.  They have to take turns running.  I would reduce the DAQmx to one task and have your code that you want to run in parallel in the same loop.  You didn't attach one of your vis so my image has them missing, but this will run the way you want, I think, as long as the one vi that you didn't attach is set as reentrant.



Randall Pursley
0 Kudos
Message 3 of 6
(14,384 Views)

Hi,

I already did what Randall has suggested but the vi inside the while loop has timing vi inside it. The purpose of the two period and non-zero variables is to set different pulse lengths on the two channels (see attached picture). My problem with the previous one is that I cannot synchronize the pulses. In what was suggested, the loop waits for the vi that has a longer delay and this does not meet the results that should be expected. I already included here the other vi.

Thank you for your help!

0 Kudos
Message 4 of 6
(14,341 Views)
Solution
Accepted by topic author ralvarez
Will this do what you want?
Randall Pursley
0 Kudos
Message 5 of 6
(14,312 Views)
Hi Randall,
 
Thanks! Your code works. Smiley Happy
0 Kudos
Message 6 of 6
(14,263 Views)