Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 801 of 909
WHILE formula
While Condition Program Flow Control
APPLICATION: Program execution and flow control
DESCRIPTION: Defines block of code that repeats while formula is true
EXECUTION: Immediate
CONDITIONAL TO: N/A
LIMITATIONS: N/A
READ/REPORT: N/A
WRITE: N/A
LANGUAGE ACCESS: N/A
UNITS: N/A
RANGE OF VALUES: Formula that evaluates true or false
TYPICAL VALUES: Formula that evaluates true or false
DEFAULT VALUE: N/A
FIRMWARE VERSION: 5.x and later
COMBITRONIC: N/A
DETAILED DESCRIPTION:
The WHILE command defines the start of a program loop that repeatedly executes as long as
the evaluated condition is true (not equal to zero). Each WHILE formula control block must be
terminated with a corresponding LOOP exit statement (see LOOP on page 522). WHILE control
blocks may be nested (see the second example).
NOTE: WHILE is not a valid terminal command; it is only valid within a user
program.
The WHILE...LOOPcontrol block looks like this:
WHILE {formula is true}
execute program command here
LOOP
The "formula" is evaluated the first time WHILE is encountered:
l
If true (not zero), program execution is sent back to the WHILE by the corresponding
LOOP command, and the formula is evaluated again.
l
If false (zero), program execution redirects to the code just below the LOOP command.
Any valid standard formula can be used. In particular, WHILE 1...LOOP is a standard "loop
forever" control block.
The formula may be similar to that used when assigning a value to a variable. However, it is
strongly recommended to always use a comparison operator such as:
== != < > <= >=
(for more information, see Math Operators on page 873).
Part 2: Commands: WHILE formula