03-01-2012 12:33 PM
I'm trying to time an event as part of larger VI, I've attached the bit I want to do the timing, it's based on the example VI. My input will be initially true then go false for a period of time (which I want to measure) and then go back to true at which point I want to stop the timing and stop this VI so it then moves on to the next step. I can see why my timer doesn't work, but I can't see what to do to make it work. Basically when the case structure goes back to true it goes back to outputing a zero, so it always just returns the value of the final timer. Is there some way i can make it store the initial value and save that to then subtract off the final value?
Cheers
Solved! Go to Solution.
03-01-2012 12:53 PM
You need a shift register or feedback node to store the millisecond timer value at which the boolean input first goes false. If the existing feedback node is equal to 0, and the value from the DAQ assistant is false, store the millisecond timer value - that's the point when the input first changed to false. Otherwise, just pass through the value from the shift register (or feedback node).
03-02-2012 04:39 AM
Cheers, but I've already tried that and can't make it work. The feedback node only stores the last value, but I need it to store the first value. The problem is that each time my while loop runs it re-runs the true/false case structure and overwrites the value in the feedback node. I can right click the tunnel on a case structure loop and say "Default if unwired" but what I really need is "use the previous value if unwired" or some equivalent way of doing that.
03-02-2012 04:57 AM
This sounds like the perfect application for an action engine (AE) with timing capabilities. This is a extended type of functional global variable.
03-02-2012 08:32 AM
@timswait wrote:
I can right click the tunnel on a case structure loop and say "Default if unwired" but what I really need is "use the previous value if unwired" or some equivalent way of doing that.
Again, you need a feedback node, as shown below:
03-05-2012 04:13 AM
Cheers, I see now, I've tried it and that does just what I need. That timer VI looks like it would be pretty handy too, but the feedback node option works fine for me.