6 if condition, If condition -17 – ElmoMC SimplIQ Software Manual User Manual
Page 46
SimplIQ
Software Manual
4BThe
SimplIQ
User Programming Language
MAN-SIMSW (Ver. 1.4)
5-17
This sequence initiates a motion using the until (MS == 0) to wait until the motor is
stabilized at a new position. The wait (20) allows an additional 20 milliseconds for final
stabilization.
Notes:
The wait argument range is [0…32,000] milliseconds. This limitation stems from the
implementation of the tick and tock system functions, used in the wait statement
algorithm. If an expression exceeds the valid range, the
SimplIQ
drive returns an
OUT_OF_RANGE error code.
The wait expression is evaluated only once, at the beginning of iterations, and is
not recalculated.
5.7.6
If Condition
Syntax:
if ( expression1)
…
statement1
…
elseif ( expression2 )
…
statement2
…
else
…
statement3
…
end
The if keyword executes statement1 if expression1 is true (nonzero); if ifelse is present
and expression2 is true (nonzero), it executes statement2. The ifelse keyword may repeat
scores of times during the if condition. statement3 will be executed only if expression1,
expression2,
… expressionN are all false (or zero).
Example:
if (IB[4])
PR=1000;
PR=1000 only if digital input 4 is ON.
elseif(IB[3])
PR=5000;
PR=5000 only if digital input 3 is ON.
elseif(IB[2])
PR=3000;
PR=3000 only if digital input 2 is ON.
else
PR=500;
PR=500 only if digital inputs 2, 3 and 4 are OFF.
end