06-04-2010 09:44 AM
Auto-indexing has to do exclusively with For loops.
When you pass an array into a For loop, notice that the terminal looks like a "box in a box" for lack of a better description.
This means that the loop will auto-index.
What this means is that if you have an array with 5 elements, the loop will iterate 5 times.
The first iteration will use element 0, the next will use element 1... and so forth.
Let me know if that explanation wasn't clear.
And the reason your VI is taking 2-3 seconds to shut down is because you told it to
The RAT and ULM commands have an 800 ms wait between each sent command (= 0.8 seconds).
And each time, the command needs to be sent twice, once to each pump, so 0.8*2 = 1.6 seconds.
Then the STP command runs twice, with a 750 ms wait, so 0.75*2 = 1.5 seconds.
So even if you only ran through your code 1 time straight through, it would take at least 3.1 seconds.
06-04-2010 09:56 AM
06-04-2010 10:04 AM
Auto indexing is active by default on for loops and can be activated if needed in while loops.
You can now see one of the disadvantages of trying to do everything in one big loop. You have added several conflicting requirements: You want independent control of several pumps. You want or need delays in various places in the program. And you want rapid response to user inputs.
Look at the Producer/Consumer Design Patterns. I think they were available in LV 7. I do not have ready access to it to check. The Producer is a loop containing an event structure to respond to button presses and control position changes. The Consumer is a parallel loop which acts on the user commands, writes data to the pumps, and performs the timing. It should probably use a state machine architecture to be adaptable, robust, and responsive.
Search the LV examples and on the Forum for many examples of these things.
Lynn