09-27-2016 03:35 PM
@Kevin_Price wrote:Couldn't resist trying it out. Turns out "DAQmx Wait Until Done.vi" with a 0 timeout seems to run with the exact same slowness as querying the Task Done? property node. I kept getting only 60-some loops/sec.
-Kevin P
I guess we now know what is under that p-node
09-29-2016 11:18 AM
It was that prperty node.. I got rid of it and am now getting 35000 loops per second, which is more than enough. To exit the while loop, I wired the boolean that checks whether or not the sum of the read voltages is less than the set voltage. As soon as the read voltages is greater than the set voltage, I get a false, then negate that and the loop exits.
I also added the elapsed time express VI as a fail-safe, in case the above condition never occurs.
Thank you both and I'll mark Kevin's post as the solution!
09-29-2016 11:50 AM
That MIGHT work fine however, I might suggest a small modification that should be a bit more responive and scaleable than a timeout via elapsed timer.
That's right, wait until done parallel to the loop with your timeout repurposed to the tmo of the wait until done. We really don't care why the wait til done finised so clear any errors and write new boolean Indicator "Stop" to True. Read Stop as a exit condition for the acquisition loop and of course, reset the value of Stop to false in case you do not clear indicators when called.
09-29-2016 12:48 PM
I do like that better. Do I need to add the 'to elapsed time' as the timeout though? The task you wired the stop condition to is set up to have a specific rate and number of samples. And in fact, I want to stop reading when that task is done. So I could do exactly what you have set up, but just do not wire the timeout?
09-29-2016 01:03 PM - edited 09-29-2016 01:06 PM
@grabillkid wrote:I do like that better. Do I need to add the 'to elapsed time' as the timeout though? The task you wired the stop condition to is set up to have a specific rate and number of samples. And in fact, I want to stop reading when that task is done. So I could do exactly what you have set up, but just do not wire the timeout?
The 'to elapsed time' was left in solely to preserve the timeout feature of your unmodified code. The only reason to leave it in there is to prevent needing to hit "Abort" if some future developer thinks that it would be a good idea to allow regeneration in the output Task (potentially causing an infinite loop.) IMHO, rip it out and leave a comment on the Task Configuration BD attached to the Task Config constant! If the next developer is too [insert deragatory term here] to heed the warning and causes an infinite loop anyway - well, that person will learn something that day.
09-29-2016 01:33 PM
Haha. Ok that's what I thought. Thanks!