LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Execute while loop with new variable

Solved!
Go to solution

Hi,

 

I have multiple parallel while loops running at different and ever changing rates. I communicate between loops with shared variables. I wish to execute the second loop only once the first loop has updated the shared variable witch is used by the second loop. i.e first loop runs, writes the shared variable at some point inside the loop (not at the end of the loop)  and only at this time the second loop should begin running and when finished waits for the shared variable to be updated in order to run again. Any ideas how this can be acieved? Thanks

0 Kudos
Message 1 of 4
(2,847 Views)
Solution
Accepted by lforni

Hi lforni,

 

I wish to execute the second loop only once the first loop has updated the shared variable witch is used by the second loop. i.e first loop runs, writes the shared variable at some point inside the loop (not at the end of the loop)  and only at this time the second loop should begin running

You should use notifiers (or a queue) instead of SharedVariables…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(2,833 Views)

As Gerd says, Event, notifier or queue is the right tools for this.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 4
(2,802 Views)

Look at this paper about producer/comsumer design patterns: http://www.ni.com/white-paper/3023/en/

Steve

0 Kudos
Message 4 of 4
(2,796 Views)