LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating an iteration value for when in True mode of a Case structure inside a while loop (beginner question)

Solved!
Go to solution

Hi, please forgive my non-technical description, as I am fairly new to LabVIEW and this is my first post. 

 

I have set up a basic code to control a CPX400DP powerpack. Currently I manually control the voltage level via a numerical control button on my front panel. I have created a 1D array of values that I have been using to "automatically" control based on the testing pattern by auto-indexing this into the While Loop. I would like to now have the option to either choose manual mode or automatic. 

 

I have started by instead having a Case Structure around the input of the Control Voltage function where false is the normal numeric control and true is my local variable version of my 1D array of values. I am struggling to get this to subsequently go down in values from the start for each loop. I have tried shift registers to start at a constant value of 0 and then tunnel out of the case structure, add 1, then come back into my case structure to act as the input for index array to return the numeric value. 

 

I am unsure if there is a much simpler way around this but I've been scratching my head on how to get it working. An "iteration value" for the loop when in the true condition would be great as once I have switched to automatic I will not return to manual mode. 

0 Kudos
Message 1 of 3
(302 Views)
Solution
Accepted by joshpet24

use a shift register initialized to 0. Increment it only within the true case of the case structure.

Message 2 of 3
(297 Views)

I knew there must have been a simple solution, I was adding multiple mathematic nodes to the iteration value for the while loop and failed shift registers and also then trying to create new arrays to feed in but this has worked super easily 🙂 Thank you for your help.

0 Kudos
Message 3 of 3
(286 Views)