fbrandeber Posted July 31, 2006 Report Share Posted July 31, 2006 Hi, I have a fairly long timer running in a while loop. (10 minutes) At the end of the programs' use, how does one avoid having to wait as much as 10 minutes for the vi to stop? Nicely, of course. :-) semi-newbie, Fred Quote Link to comment
crelf Posted July 31, 2006 Report Share Posted July 31, 2006 Because your timer is in a whiloe loop, I assume that it's looping on whether a target time has been reached? Put a button on the front panel and "OR" it with the timer. It'd be a lot easier to help if you post either your code or a screenshot... Quote Link to comment
jpdrolet Posted July 31, 2006 Report Share Posted July 31, 2006 Hi, I have a fairly long timer running in a while loop. (10 minutes) At the end of the programs' use, how does one avoid having to wait as much as 10 minutes for the vi to stop? Nicely, of course. :-) semi-newbie, Fred The Wait functions are not interruptible so when you put them in a while loop, the loop will take 10 min to execute. Instead of using a Wait function, create a notifier and use Wait Notification (with timeout) which can be interrupted by sending a notification or destroying the refnum. If the Wait Notification times out with no error, this indicates that the loop can run next iteration. If it doesn't time out (notification received) or output an error (refnum destroyed) the loop can exit. Quote Link to comment
Mholt Posted July 31, 2006 Report Share Posted July 31, 2006 Here is a VERY simple example of how I would handle the situation. I am in LV 8... Download File:post-4836-1154350532.vi Quote Link to comment
jhoskins Posted July 31, 2006 Report Share Posted July 31, 2006 Here is a VERY simple example of how I would handle the situation. I am in LV 8... This solution does not fit his needs as he has described. If I understand the question correctly. What you are saying is that you want to use a while loop to process something then wait ten minutes and process again but you want to implement a sort of emergency stop were the user may not be able to wait the ten minutes. if this is the case i would suggest that you use JP's suggestion. Quote Link to comment
fbrandeber Posted August 3, 2006 Author Report Share Posted August 3, 2006 This solution does not fit his needs as he has described. If I understand the question correctly. What you are saying is that you want to use a while loop to process something then wait ten minutes and process again but you want to implement a sort of emergency stop were the user may not be able to wait the ten minutes. if this is the case i would suggest that you use JP's suggestion. Thanks to ALL! :-) I have generated a LV8 version of my interpretation of JP's suggestion and attached it. It did not occur to me until later that I was given a requirement this does not fill easily. Perhaps someone can help me implement it. In my example I just put a flashing lamp for the function to be performed. It appears to work fine, but I am also supposed to perform the function(collecting data from several acquistion boxes via USB) as soon as the program starts, sort of a baseline. . . Right now the only way I can think of to do that is put a copy of the elaborate function outside the loops, so it runs once immediately. Perhaps someone can point me to a better way? Thanks again, Fred Download File:post-4712-1154577090.vi Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.