03-27-2024 04:40 AM
Hi all,
I'm working on a VI where I can import a 2 column table containing some setpoints so that I can control 2 mass flow controllers from the front panel without needing to type each setpoint individually. I tried to do this with a for loop where the table is broken down into two 1D arrays and each array is indexed for the next setpoint every time I flick a switch so that the setpoint is sent to a subVI that adjusts the controller. Inside the loop, I can see the arrays are being indexed properly but when I pass them out of the loop via auto-indexing, the index reads at zero while the loop is in progress. Once the loop is done, it will show the last values of the array (i.e. 19 element array will only show the 19th element). Any help on this is much appreciated.
Cheers, Kieran
Just some further notes for more context:
03-27-2024 05:54 PM
We can debug am image. Please post your code instead, preferably in an earlier version.
03-28-2024 08:52 AM - edited 03-28-2024 08:53 AM
Apologies, I thought the vi had been attached. I've also attached one of the tables I would use this code for. Thanks.
03-28-2024 02:07 PM
The way your program runs this way the FOR loop will run First.
" but when I pass them out of the loop via auto-indexing, the index reads at zero while the loop is in progress"
The part of the code outsize of the loop will be executed only AFTER the loop is done.
If you want the sub vi to run every time you click the switch then the Subvi should be inserted inside the loop.
03-28-2024 03:13 PM
Ah ok I understand what you mean there. I'm not sure if I'll be able to insert the subVI into the for loop as it needs to be running continuously for data acquisition and logging purposes. Any are there any alternatives to the for loop where I can import a table of inputs and feed the inputs consecutively (one at a time) to some indicator at my own leisure with a switch? Thanks.