webbguy Posted May 1, 2007 Report Share Posted May 1, 2007 I am running a vi with muiltiple loops which generate different I/O's which i want to write to a master global array. Right now my current method is that I have a non-reenterant vi set up to write to the global and each loop uses this sub-vi to prevent over writing data from each other loop. This presents the problem of loops having to wait for other loops. My other option is several small global arrays which I can combine in a separate loop but this is much more anoying for organizing data. Is there any better method for each loop to write to the same array without having to wait for other loops? Quote Link to comment
Yair Posted May 1, 2007 Report Share Posted May 1, 2007 The easiest and safest way is the way you're already doing it (assuming you're using an uninitialized shift register for your data store and not a standard global variable). You can have an init case for initializing the array to its full size, a write case which accepts an index and a value and does a replace and a read case which can return the entire array as well as the index you wired in. You can have 2 of these (one for DI and one for DO) and have the default action in each different (write for DO and read for DI). If you want analog, you can add more of these globals. I'm not sure why you are concerned about the locking this creates. Unless your loops need to run extremely fast (usually faster than the speed with which you can get the actual I/O) the delay caused by locking this VI will be negligible. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.