P
ar
t
2: C
omman
d
s
Moog Animatics SmartMotor™ Developer's Guide, Rev. L
Page 423 of 909
ELSEIF formula
IF-Structure Command Flow Element
APPLICATION:
Program execution and flow control
DESCRIPTION:
Alternate evaluation of IF...ENDIF control block
EXECUTION:
Immediate
CONDITIONAL TO:
Value of
formula
and previous IF
formula
or ELSEIF
formula
LIMITATIONS:
Must reside with IF
formula
...ENDIF program control block; can
be executed only from within user program
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:
An IF formula's control block may optionally include any number of ELSEIF formulas to
perform multiple evaluations in a specified order. For example, ELSEIF would be used when
you want the SmartMotor™ to do one thing if the variable g=43, another if g=43000, and
another if g=-2.
For more detail about valid
formulas
that can be used, see IF formula on page 475.
EXAMPLE:
IF
g==43
("Gee...43!",#13)
ELSEIF
g==43000
("43 grand for me.",#13)
ELSEIF
g==-2
("2?",#13)
ENDIF
The first line checks to see if g is equal to 43. If so, the string "Gee...43!" is sent out the
primary serial port and the IF control block terminates. If g is not 43, the program goes on to
test if g is 43000. If it is, then "43 grand for me." is sent out the primary serial port and the IF
control block terminates. Similarly, if g is not 43000, then the program goes on to test if g is -
2. If it is, then "-2?" is sent out the primary serial port and the IF control block terminates.
An IF control block can have multiple ELSEIF statements. If such an ELSEIF clause exists and
the language interpreter evaluates the IF formula to be false (zero), then the program will
branch immediately to first ELSEIF formula.
Part 2: Commands: ELSEIF formula
Содержание SmartMotor
Страница 1: ...Developer s Guide Class 5 Later SmartMotor Technology with TM ...
Страница 909: ...PN SC80100003 002 Rev L ...