LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Clay_Rogers

Built In Delay into While Loops

Many times a while loop needs a delay for one reason or another, even if its just to add a small delay so the program doesn't peg the processor.  Having this would clean up BDs, and it would also act as a reminder to make sure your code doesn't peg the processor.  (with nothing wired to it, it would default to zero)

Built In Delay into While Loops.png

16 Comments
Dennis_Knutson
Knight of NI
I know that few of my loops in the last few years need a wait. I have a lot of while loops with an event structure and a lot of while loops with hardware I/O. No need for waits at all. I don't see the need to modify LabVIEW either.
tst
Knight of NI Knight of NI
Knight of NI

How about adding another while loop with a wait to the structures palette?

 

I haven't looked at AQ's code, but I've had a merge VI in my structures palette for years which drops a while loop with a wait (defaulting to 100 ms) and a stop button and another one which drops a loop with an event structure and a stop button.

 

These merge VIs are very useful for me when I want to write a quick VI to test something and don't want to use the run continuously button. This will also be similar to the while loop from the express palette which, if memory serves, is dropped with a stop button. It will also make the structures palette more crowded, which is a valid argument against it. 


___________________
Try to take over the world!
Intaris
Proven Zealot

One usage I would like to highlight is the apparent target audience of NI, the vast majority of which won't be posting here.

 

N00bs.  How many times do people answer problems from users who simply don't understand the ideas behind task-sharing.  These less-experienced "programmers" (I use the term with reluctance) are probably the ones who would benefit from this most as they will have less heavy items to drop on their feet while "programming".

 

I would probable almost always use the version without, but I can see a use for it.

 

OTOH, what percentage of code uses User Events?  Or Semaphores? Or Occurrences?  Should we get rid of them because the're not mainstream (With the possible exception of feedback loops)?

 

PS I would prefer the default state to be with a red line through it indicating no wait and only becoming active if something is wired to it.  This is a slight difference to the "zero when unwired" which I think would make it more usable.

Message Edited by Intaris on 03-22-2010 07:45 AM
Brian_K.
NI Employee (retired)
I believe this is already addressed with the timed loop.  Also most of my loops don't needs waits.  If you did add it you would need an option to choose wait until versus just wait, which once again seems like a lot of work for a feature not often to be valuable.
Brian K.
Intaris
Proven Zealot

Don't timed loops add sone not inconsiderable overhead though?

 

I don't see the two as being equivalent.

G-Money
NI Employee (retired)