05-05-2012 07:06 PM
I'm writing a program to collect two separate data points.
I found a way to get LabView to "weed out" the 0 values collected during the "no event" time of the while loop, but only for one of the data points [the "event" of the user asking for the first data point to be collected].
However, from the second For loop, I keep getting "0". Is the first For loop finishing first and ending the program? Or is there a flaw in my thinking that the two paths should function the same?
05-05-2012 07:28 PM
There is no difference between the For Loops. Any differences in behavior must be due to the way you are operating your program.
Rather than collecting zeroes by auto-indexing on the while loop with default data at the tunnels sometimes, just build the arrays in the while loop in the appropriate event case?
05-06-2012 10:13 AM - edited 05-06-2012 10:22 AM
I've tried building the array both in and outside. My problem is that I only want to take the one value from that array that's greater than 0.6, so I can subtract the two values. So I guess another related question could be whether I can get the event structure to pass only one element.
Or, if I keep the For loops, but put them within the while loop, can I use a shift register to keep a value from changing back to zero? (Like get it to keep that value every iteration?)
05-06-2012 10:39 AM - edited 05-06-2012 10:40 AM
If your device has analog trigger capability, set it to trigger at the 0.6 threshold and collect one point. No extra data to manipulate.
The way you are using the event structure will likely lead to problems in the future if it does not already contribute. Look at the Producer/Consumer Design PAttersn.
Lynn
05-06-2012 10:58 AM
Unfortunately, with the way my experiment is set up, that wouldn't work.
I'm trying to find the linear calibration of a sensor using two weights, so I need to be able to collect data only once for each added weight.
05-06-2012 11:19 PM
What you need to do is use a couple of shift registers in the while loop and then simply subtract when complete. I attached my solution based on what you had already done. I don't have DAQmx on this machine, so that part might have gotten messed up. And I think I might have switched the direction of the subtraction.