LabVIEW

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

Difference between running continuously and While loop

Solved!
Go to solution

Hi All

 

Is there any Difference between running continuously and While loop apart from Conditional terminal in while loop?

 

 

0 Kudos
Message 1 of 11
(500 Views)

You refer to the "Run Contiously" button in the icon bar?

You shouldn't use that. The issue is that most users press the "Abort" button to stop execution which could be fatal. Not necessarily fatal for humans (but possible) but more on hardware (if used) and at least software data integrity.

So get used to always implement loops in case you need repetative execution.

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 11
(498 Views)

Yes, I am referring to Run Continuously in the icon bar.

 

I have got the point that it's not recommended to use Run Continuously, but is there any difference in term of execution of the VI.

0 Kudos
Message 3 of 11
(492 Views)

Things that contain "First call" might not behave the way you expect.

Not sure what differences there are behind the scenes though.

 

0xDEAD

Message 4 of 11
(487 Views)

@deceased wrote:

Things that contain "First call" might not behave the way you expect.

Not sure what differences there are behind the scenes though.

 

0xDEAD


There are several ways to specify a number base.  In documents, the most proper way is: "DEAD hexadecimal", or "DEAD hex"; even "DEAD16" is considered acceptable.  In computer programming languages we find things such as:

Ada             16#DEAD#
Assembler   0DEADh
Basic           &hDEAD
C                 0xDEAD
Fortran        Z"DEAD
Pascal        $DEAD

I don't understand why people so often choose an icky way (0x...) to designate hexadecimal in documents.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 5 of 11
(454 Views)

@paul_cardinale wrote:

@deceased wrote:

Things that contain "First call" might not behave the way you expect.

Not sure what differences there are behind the scenes though.

 

0xDEAD


There are several ways to specify a number base.  In documents, the most proper way is: "DEAD hexadecimal", or "DEAD hex"; even "DEAD16" is considered acceptable.  In computer programming languages we find things such as:

Ada             16#DEAD#
Assembler   0DEADh
Basic           &hDEAD
C                 0xDEAD
Fortran        Z"DEAD
Pascal        $DEAD

I don't understand why people so often choose an icky way (0x...) to designate hexadecimal in documents.


I would think its probably the most recognised way to denote it.

I will change to $DEAD for now as hark back to the simpler days of the Motorola 6800 assembly. I just hope I don't Halt and Catch Fire.

 

$DEAD

Message 6 of 11
(439 Views)

It's more a question of "habit", both Good and Bad.

  • Run Continuously basically means "Run and never stop".  If you really intend for this to happen (for example, firmware for an instrument that is on 24-7-365), this may be OK, but if you intend for your program to stop, you may want to program a Shutdown routine (close files, stop hardware, dump the Error Log, etc.).
  • Thinking about "how do I safely stop this routine" often leads to better code.
  • If you ever build your program into an Application, you may not have an Abort button, but will also not have a "Run Continuously" button (the program will start running when it is loaded, at least this is my experience).
  • If you want the functionality of Run Continuously, you can always "program it" by enclosing the code in a While Loop and wiring "False" to the Stop terminal.  This has some additional advantages:
    • You can use Shift Registers on the While loop.
    • You can have some "run-once-before" initialization code done outside the While Loop and bringing their results into the Loop.

Bob Schor

0 Kudos
Message 7 of 11
(431 Views)
Highlighted
Solution
Accepted by topic author Hemant_LV
02-14-2019 08:28 PM

@Hemant_LV wrote:

I have got the point that it's not recommended to use Run Continuously, but is there any difference in term of execution of the VI.


  • "Run continuously" is a misnomer. More accurate would be "restart the VI from scratch whenever it completes all of it's code", but that would not fit on the tip strip. Smiley Very Happy
  • It is a debugging tool, nothing more. I use it to e.g. troubleshoot subVIs that don't have a toplevel loop in standalone mode to quickly test how the outputs change when I twiddle the controls.
  • Any reasonable toplevel code contains initialization, operation, and shutdown parts. Typically only the operational parts belong inside a toplevel loop. You don't want to continuously start over with potentially expensive code that really needs to be done only once.
  • "first call?" will not work right as has already been mentioned. Every call is a first call! Smiley Very Happy.
  • Also, any code that uses a feedback node set to "initialize on first call" will work differently under continuous run vs. regular run mode.
  • "Run continuously" will run as fast as the computer allows, redlining at least one CPU core unless there is a wait somewhere (there probably ins't!). This starves other processes and reduces battery life. A toplevel while loop typically has a reasonable wait.
  • A VI running under "run continuosuly" cannot be stopped normally, just aborted. This can be dangerous, e.g. the 100kV source controlled by it may remain turned on, putting people and hardware in danger.

LabVIEW Champion Do more with less code and in less time
Message 8 of 11
(388 Views)

@altenbach wrote:

A VI running under "run continuosuly" cannot be stopped normally, just aborted. This can be dangerous, e.g. the 100kV source controlled by it may remain turned on, putting people and hardware in danger.

You don't have to abort. You can click the "run continuously" button a second time and the VI finishes normally.

Message 9 of 11
(343 Views)

@UliB wrote:

@altenbach wrote:

A VI running under "run continuosuly" cannot be stopped normally, just aborted. This can be dangerous, e.g. the 100kV source controlled by it may remain turned on, putting people and hardware in danger.

You don't have to abort. You can click the "run continuously" button a second time and the VI finishes normally.


Correct. But most users don't know this and do use ABORT....

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 10 of 11
(324 Views)