Jump to content

If you don't want wait for the end of waiting time...


horatius

Recommended Posts

QUOTE (horatius @ Nov 4 2008, 05:19 PM)

I have loops with long waiting periods. If I press a button the VI should stop the current waiting cycle and continue without passing of whole waiting time. I think it's possible with Event Structure but there must be an easier way to do this.

We use queues and notifiers for this (they act the same way). You can have the notifier wait as long as you want (or forever), and then you can close or destroy it from another loop and it will stop waiting. We call this "scuttling" and we use it everywhere. You will want to filter error 1 and error 1122.

Link to comment

Hmm.... Well, I think in most cases the event structure is the way to go. I think it's worth learning to use it well before pursuing other approaches. Maybe it would be more beneficial for us to help you with your implementation of the event structure. I'm sure there are other opinions, though.

Link to comment

QUOTE (horatius @ Nov 5 2008, 08:05 AM)

then I have one frame more around my loop and the arrangement is becoming bigger and bigger and less clear

but maybe someone has an easy solution

Maybe you should break up your code inside the loops into sub-VI's? You can't dump everything into the top-level VI.

N.

Link to comment

horatius, I tried it that way first and had some problems. But now I went back and re-did your way and it works fine. I'm glad you found an easier way.

Oh I remember what my problem was.... make sure you are not doing anything in the Timeout case because it only will get done every 10,000msec (or whatever you set the event time to). The way I made my example, you can see the time string update every sec but if you changed the timeout from 1000 to 10,000 then you would only see the string update once every 10sec!

It's not a big deal if you are not doing anything in the timeout event but waiting, though.

Link to comment

post-858-1226005531.png?width=400



To add events to the same case:
1. Right click on the event bar (where it says "Timeout")
2. Select "edit events handled by this case"
3. In the pop-up window press the blue + button
4. then select the Stop control and pick "Value Change" (just like before)
Now both event are in the same case

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.