As promised, here is the first pass tweak of your code. You'll notice that I have added a couple subVIs for managing errors that arise in the code. First, "Error Fork Stacker.vi" takes two error clusters and combines them into one. The other, "Error Stacker.vi", allows you to trace back an error to the exact instance of a vi that is generating an error--which can be helpful if your code uses the same subVI in several places. Finally, "Error Handler.vi" is sort of a shell that you need to customize a bit. As is, if the input error cluster is presenting an error it presents the user with a dialog box that allows them to either ignore the error and continue, or quit the application. The customizing you need to add is code for shutting down the external devices safely and bringing things to a safe condition.
Beyond that, a few things to be careful of is passing error clusters and refnums through FOR loops. You almost always want to pass them through using shift registers. First, without shift registers, if the FOR loop executes zero times signals originating inside the loop are passed out as default values which will hide any incoming error. Likewise, any refnums will be invalid coming out. If you use shift registers though, with zero iterations LV will set the right side of the SR to equal the left side, thereby preserving any input values. Second, without SRs any errors that occur on loops before the last one will be lost.
Another style point that can become very important, is to take the few extra seconds to route your wires neatly and make sure they don't run under other parts of your code. In the short term, I know it doesn't seem like a big thing but that's because right now you remember where everything connects. Give is 6 months or so and the memories grow dim and you'll spend a lot of time trying to remember where things go. I learned a long time ago that if you write your code such that its operation is apparent by ***reading*** it, you don't have to worry about ***remembering*** how it works. Which a the lady on TV says, is a GOOD thing...
Also note that I haven't addressed what your code actually does. By that I mean I haven't looked at any potential synchronization problems that might arise from the two routines that are operating in parallel--though I noticed another poster has addressed that issue.
If you have any questions on any of this, feel free to contact me directly...
Mike...
PS: remember that the hardest LV application you'll ever write is your first one because if you did it right, the second application you write will be half done when you start it...
mporter@arielcorp.com