Showing results for 
Search instead for 
Did you mean: 

difference between using while loop & run continously

   i like to know the difference between using while loop &  using run continuously ,  because i saw many aplication where they are using while loop just for closing the total execution.....
thanks in advance
0 Kudos
Message 1 of 4
In general you can say you should never use 'run continiously' it is just a debugging feature. Your end users should never use the run (or run continiously) button.
A stop button is much better

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 4
With the Run Continuously and Stop buttons (on the toolbar) you don't have any control of when the program ends. That stop button halts the program wherever it happens to be in the code.

By including a while loop, you can now end your program very cleanly, and based on any number of factors. For example, you may want to end the program after an indicator reaches a certain count, or close a file after the program ends, or stop when the program reaches a certain time, etc. Look at all the example programs - there's a reason most of them have while loops.


0 Kudos
Message 3 of 4
As others have already said, the "run continuously" button has no valid purpose in a toplevel program. It is actually named somewhat misleading, because what it really does is restarts the program automatically whenever it finishes.
Any bigger program consists of serveral stages, e.g. Initilizations where conditions and hardware are configured, memory allocated, files are opened, Main where the actual purpose takes place, handle operator input, display results, etc., shutdown where things get cleaned up, references closed, etc.
Usefull tools such as the "First run?" function loose all meaning during "run continuously". Also event structures don't work well in this mode.
Sure, if you are just started learning labview and just want to e.g. add two numbers (for example) you are allowed to use "run continuously" 🙂 It does not matter that the program uses 100% of the CPU doing mostly the same calculation over and over (and over and over...) again. However, in the second lesson, you should learn about loops an use them from then on. 🙂
One valid use for the run continuously feature is for example if you need to debug a subVI which does not contain a while loop. Using the "run continuously button" will allow you to quickly play with a series of input values while observing the result, probing the diagram, etc. It is one of the cool features of LabVIEW that subVIs can be run independenly without any need to write e.g. a primitive test caller.
0 Kudos
Message 4 of 4