LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structure Confusion

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:

wait test.png

I've also attached the VIs in case that didn't work:

Download All
0 Kudos
Message 1 of 4
(2,971 Views)

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?

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 4
(2,963 Views)

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.

0 Kudos
Message 3 of 4
(2,958 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 4
(2,936 Views)