06-25-2015 05:00 PM
Hi all,
I'm trying to debug a little piece of code that's misbehaving. It's an event-interruptable wait VI. Ostensibly, it will work the same as the built in Wait VI, but it will be allowed to have events interrupt its execution. Here's the snippet:
I've also attached the VIs in case that didn't work:
06-25-2015 05:21 PM
You will not be able to interupt that wait VI because you need to wait until it completes execution. Because there is a while loop that waits X seconds you will always have to wait X seconds.
What is it exactly that you want to do though? If you just want to wait X seconds unless that is interupted can you just have a timeout of X?
06-25-2015 05:30 PM
Here's a link to a post that more fully describes my problem: http://forums.ni.com/t5/LabVIEW/Convert-single-while-loop-with-variable-Timing-literal-to/m-p/315494...
I have a while loop that needs to wait for differing amounts of time, n or 2n minutes. n or 2n is computed based on current and a few previous sensor values and fed into that Timing VI. As I understand it, Event structures cannot cut short a timing VI, but they can with user-created VI's. For example when the user wants to quit the application in the middle of a wait, an event structure would allow them to do that safely.
06-25-2015 06:41 PM
Just use the timeout of the event structure. Set the timeout to be whatever your wait is an it will wait that long (timeout) or until you have another event. If you have other things happening, then you will want to shorten your timeout, do you other stuff, and come back. You can subtract the timestamp from when you started your original wait from the current timestamp to see how long you have actually been waiting and stop this cycle when your X minutes has elapsed.