LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counting Boolean "events" with multiple While Loops

Hello,

I have a program in which I am reading voltages from a USB-6008 and then doing some processing to display the power and voltage. The VI will take a value for the "Lowest Resistor" and then use that to calculate the power and the current from the voltage measurement. The output is then displayed in a graph and put into an array. I am using an external potentiometer with defined steps, so I initially set up the VI to take a user input for the initial resistor value ("Lowest Resistor"), and then you would have to change the "Resistor Muliplier" dial to the value on the external pot and then press the "Aquire Data Point" button. Then you have to rotate the dial on the VI and the pot and hit the aquire button again to get the second point and so on. This can get a little tedious. So I wanted to have the Resistor Mulitpler increment by 1 every time the "Aquire Data Point" button was pressed. I have used parts of code I found online to do this, by using a case structure inside the While Loop. The case structure inside a while loop works great (I tested it in a seperate VI), but the problem is that when I use it in my VI, the multiplier never gets above 2, because there are multiple while loops and they keep resetting the value. I have used shift registers, but I must need some other form of "remebering" what value the button is on. I have tried the shift registers on all of the While Loops (three in total), and I get the same result, or close to it, each time, resetting of the increment value.

I have attached my VI and tried to add descriptions to most of the parts.

Any help would be greatly appreciated.

Kenny
Kenny

0 Kudos
Message 1 of 4
(2,605 Views)
You almost have/had it...
the constant needs to be further outside the outtermost loop so it cant reset...

Then again after reading your question again sounds like you might have already done this. I cant troubleshoot it further as I dont have DAQmx Base installed 😕

See picture:

Message Edited by Chaos on 06-30-2005 03:17 PM

0 Kudos
Message 2 of 4
(2,598 Views)
Each while loop would need a shift register and you wire one to another. See attachment.
0 Kudos
Message 3 of 4
(2,595 Views)
Thank you both for you solutions. It works perfectly now, I knew it was something simple I was missing.
Kenny

0 Kudos
Message 4 of 4
(2,584 Views)