Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 522 of 909
LOOP
Loop Back to WHILE Formula
APPLICATION: Program execution and flow control
DESCRIPTION: Terminator for WHILE formula
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: N/A
TYPICAL VALUES: N/A
DEFAULT VALUE: N/A
FIRMWARE VERSION: 5.x and later
COMBITRONIC: N/A
DETAILED DESCRIPTION:
LOOP is the statement terminator for the WHILE control block. Each WHILE must have only
one corresponding LOOP. Each time LOOP is encountered, program execution branches back
to reevaluate the WHILE formula.
The WHILE formula...LOOP control block creates a program loop that repeatedly executes for
as long as the formula value is true or nonzero. The formula is evaluated when WHILE is first
encountered, and each time program execution is sent back to the WHILE by the
corresponding terminating LOOP statement. If the formula value is zero or false, program
execution continues on the line of code just below the LOOP command.
WHILE formula...LOOP
It is legal to jump from an external program location to a label within a WHILE control loop.
However, this method may not be the best practice.
LOOP is not a valid terminal command. It is only valid within a user program.
BREAK can be used to exit the WHILEloop.
EXAMPLE:
b=1
WHILE b<5
PRINT(#13,"b=",b)
b=b+1
LOOP PRINT(#13,"Exit Loop")
END
The previous code outputs:
Part 2: Commands: LOOP