LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

synchronisation of two for loops...

Solved!
Go to solution

 

hii....

 

 

i am using two for loops and i want that each iteration for both for loops start at same time..

actually i want synchronisation between these two loops..

so when the each iteration of both loops will start at same time then these will be synchronised..

also if one loop take more time in one iteration then the other loop should pause until the other's iteration completes..

 

 

 

please hlp me...thanks... 

thanks

do not hesitate to give kudosSmiley Happy
0 Kudos
Message 1 of 8
(3,915 Views)
well when your for-loop's are working in parallel they should be synchronised unless you have different delays for each for-loop as Labview executes code via data flow.
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 2 of 8
(3,907 Views)

hiii  

 

 

you are right thatthe loops will be synhronised as Labview executes code via data flow. 

here i mean of synchronisation is that i want each iteration to be started at same time only... 

 

 

 this is what i am not getting..

 i have tried it to b done by defining a local variable in one loop and using its value in the other but it did not work.. 

 i hav tried some more methods but in vain...

 

 

 so i am here...

 

 

 thanks..

 

 

 

 

 

 

 

 

thanks

do not hesitate to give kudosSmiley Happy
0 Kudos
Message 3 of 8
(3,904 Views)

Well if you are using local variables like that you may have race conditions which will cause your program to have problems

 

 

can you post an example of your vi or the vi that is in question?

Message Edited by Harold Timmis on 10-25-2009 06:34 AM
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 4 of 8
(3,901 Views)

hii..

 

 

 

i am not having problems regarding race condition..as i have the solution for it...it is not of worry...

 using local variables ::

 

 if i place the local variable (say for output of add command) in the other vi then the problem is that the local variable also takes the previous value which is of no mean...i want that it takes the value until the output of first loop during first iteration is not coming ie it must ignore the previous value...

 

 thanks...

 

 

 

 

 

 

 

 

 

thanks

do not hesitate to give kudosSmiley Happy
0 Kudos
Message 5 of 8
(3,880 Views)
Solution
Accepted by topic author sahil

Hi sahil,

 

two options:

1st: when both FOR loops should have same iteration times why not simply put all code in just one FOR loop?

 

2nd: when 1st isn't possible/wanted you can use a notifier. Set the notifier at iteration start of the first FOR loop and wait for the signal in the second loop...

 

3rd: use timed loops and synchronize them...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 8
(3,871 Views)

 hii GerdW

 

 

 

thanks once again you have solved another problem of mine...thanks a lot..

what i say ?? i don't have the words to praise you...

 

thanks a lot..

thanks

do not hesitate to give kudosSmiley Happy
0 Kudos
Message 7 of 8
(3,847 Views)

Hey sahil

 

just click this link and you will get your answer regarding how to create a sub-vi.

 

(i am posting this here, though this thread is regarding something else but this is the only way i can communicate with sahil)

 

 

Somil Gautam
Think Weird
0 Kudos
Message 8 of 8
(3,817 Views)