01-29-2015 10:20 AM
Hello - as usual, one problem gets solved another appears! I've built a simple State Machine to take a measurement for a user-defined period of time (X) and pause/wait for a user-defined period of time (Y) before taking another measurement. It works perfectly well if X>Y, but for some reason when X<Y, after the first pause it takes a single data-point every Y seconds. Any ideas appreciated, Cheers.
Solved! Go to Solution.
01-29-2015 10:34 AM
Look closely. It isn't working in either case.
The issue is that it resets and counts your "wait time" as part of its "measurement time". So put measure 10 sec, wait 9 sev and you will see that it only measures for 1 sec after the first measurement.
Unwire the auto reset on your timer function, and instead reset when i = 0.
01-29-2015 10:44 AM
I don't have the LINX VI's but it appears that this program takes samples for the Sample Time (X) and then wait for Y amount of time due to the while loop in your measurement case. Is it one sample you want or several? The read vi is potentially called thousands of times per second in that delay loop.
Also, the elapsed time Vi is set to auto reset, so it will have reset when Y>X. You probably just want to use the reset control.
Without the measurement VIs I can't say how your instrument is configured, but usually you would configure the VI to take a measurement for sample time so that when you call a read, it takes as long as it needs to to return the sample.
01-29-2015 11:25 AM
Thanks for the quick reply, I see the problem now - how does one reset when i = 0, though? The input for Reset only allows T or F constants...
01-29-2015 11:43 AM
@RNG wrote:
Thanks for the quick reply, I see the problem now - how does one reset when i = 0, though? The input for Reset only allows T or F constants...
Oh come on. You can figure that out...
01-30-2015 04:20 AM
Haha, I had that "end-of-day" confusion. That's it sorted, thanks very much!
01-30-2015 04:21 AM
Thanks for the help qzerror as well.