キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Difference between running continuously and While loop

解決済み
解決策を見る

Hi All

 

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

 

 

0 件の賞賛
メッセージ1/20
9,362件の閲覧回数

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.
メッセージ2/20
9,360件の閲覧回数

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 件の賞賛
メッセージ3/20
9,354件の閲覧回数

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

Not sure what differences there are behind the scenes though.

 

0xDEAD

メッセージ4/20
9,349件の閲覧回数

@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 件の賞賛
メッセージ5/20
9,316件の閲覧回数

@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

メッセージ6/20
9,301件の閲覧回数

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 件の賞賛
メッセージ7/20
9,293件の閲覧回数
解決策
受理者 LV_COder

@LV_COder 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. 😄
  • 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! :D.
  • 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.
メッセージ8/20
9,250件の閲覧回数

@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.

メッセージ9/20
9,205件の閲覧回数

@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.
メッセージ10/20
9,186件の閲覧回数