LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Auto-indexing to pass indices out of a for loop when a switch is flicked to control a mass flow controller (Alicat)

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

kieran_r_1-1711532053274.png

 

Just some further notes for more context:

  • After the importing the table, I read the first row separately as these are always the table headings.
  • The second read block is where the setpoints are read.
  • I split the 2D array them into 2 array subsets.
  • I take the 1D array length as the no. of iterations for the for loop.
  • The event structure is there so that the loop progresses to the next iteration when I flick the boolean toggle otherwise it waits for 10 mins.
  • I'm not able to put the rest of my VI inside the for loop.
0 Kudos
Message 1 of 5
(263 Views)

We can debug am image. Please post your code instead, preferably in an earlier version.

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 2 of 5
(193 Views)

Apologies, I thought the vi had been attached. I've also attached one of the tables I would use this code for. Thanks.

Download All
0 Kudos
Message 3 of 5
(169 Views)

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. 

 

0 Kudos
Message 4 of 5
(149 Views)

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.

 

0 Kudos
Message 5 of 5
(135 Views)