09-03-2011 05:05 PM
Hello
how can make decisions in labview based the output of the data acquisition..
For example. if I have a voltage comming in from the light sensor...and lets say I want run the for loop this many times if the voltage comming out is greater than some threshold...any examples.
Thanks
SK
09-03-2011 06:07 PM
09-03-2011 06:18 PM
well, what I tried to is this:
I had DAQ assistant and from there I connected my graph to the output, and then I replaced that graph with an indicator...and I wired that indicator to the select VI and then hooked that to the for loop. So i said if the voltage in the indicator is above a threshold then output should be 5(the number of iterations for the loop) and when i ran the program, and the for loop did not iterate.
09-03-2011 06:55 PM
Sounds like a simple Case structure problem unless I am missing something. It would be easy to suggest if you have a snapshot of your VI or actual VI attached.
-Nilesh
09-03-2011 07:00 PM
09-06-2011 06:58 PM
well here is the thing
I have a DAQ assitant in the while loop....now Iam using a compare and select function to determine the number of the iteration of the for loop..
Now here is the problem...
here is the program, the for loop does not iterate
09-06-2011 08:14 PM
1. What makes you think the for loop does not iterate? If the Start Stop toggle switch is in the Stop position, the while loop inside the for loop will never end so the for loop will stay in its current iteration waiting for the while loop. If the switch is true, then the for loop will run through its 10 or 20 iterations in 1 or 2 seconds.
2. It is usually better to create and start the task outside the loop, write the data inside the loop and then clear the task after the loop finishes.
3. Your indexing of the boolean array to write can be done very simply with the Quotient & Remainder function and a Subtract from 3 inside the false case of the CCLW/CLW structure.
Run your VI with Highlight Execution (the light bulb on the block diagram toolbar) turned on and watch what it does.
Here is a cleaned up version of your diagram showing the simplified indexing.
Lynn
09-06-2011 08:17 PM
Try running your code with execution highlighting turned on (the light bulb icon in the toolbar) so you can see what your code is doing and the order in which your loops execute. I can't figure out what you're trying to do with this code, but perhaps if you watch how it executes you'll have a better understanding of why it doesn't do what you expect.
09-06-2011 08:20 PM
I have tried that too, I mean with the start on in the for loop....but the the Value that comming out of the select VI does not output anthing. I clicked on start in the for loop... and I even placed an indicator at the output of the select, it stays 0...
I just dont know how to fix it.
09-06-2011 09:17 PM
Here is the thing I cant figure out, just dont know how to fix it..
whenever the graph indicator fromt he DAQ assitant is in the while loop it gives me the data and as soon as it is outside it gives me no data..