Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 477 of 909
EXAMPLE: (Test for two conditions and default to another line of code.)
IF PA>100 'If Position is above 100
PRINT("position is greater than 100",#13)
ELSEIF PA<=0 'If it less than or equal to zero
PRINT("position is <= to zero",#13)
ELSE
PRINT("position is between zero and 100",#13)
ENDIF
EXAMPLE: (Binary bit mask comparison.)
a=10 'binary 1010
b=5 'binary 0101
c=7 'binary 0111
d=1 'binary 0001
e=0 'binary 0000
IFa&2 'Compare "a" and 2 as binary numbers bit for it.
PRINT("This is true because 2 is 0010",#13)
ENDIF
IF a&d 'Are any bits in common with a AND d?
PRINT("This will never PRINT",#13)
ENDIF
IF a|b 'Are there any bits that are 1 in either number?
PRINT("This will print",#13)
ENDIF
IF d|e 'Even though e is zero, d is nonzero:
PRINT("This will print",#13)
ENDIF
IF b&c
PRINT("This is true",#13)
ENDIF
END
RELATED COMMANDS:
ELSE IF-Structure Command Flow Element (see page 421)
ELSEIF formula IF-Structure Command Flow Element (see page 423)
ENDIF End IF Statement (see page 433)
Part 2: Commands: IF formula