6 fault handling, 1 unexpected fault, 2 expected fault – ElmoMC SimplIQ Software Manual User Manual
Page 41: 7 program flow commands, 6 fault handling -12, Unexpected fault -12, Expected fault -12, 7 program flow commands -12

SimplIQ
Software Manual
4BThe
SimplIQ
User Programming Language
MAN-SIMSW (Ver. 1.4)
5-12
5.6
Fault Handling
5.6.1
Unexpected Fault
In order to receive more information about the reasons for run-time errors, the Elmo Studio
IDE must be used. This enables the
SimplIQ
drive to inform the virtual assembly that a
failure has occurred, and to then have the Elmo Studio interpret this to a user program
command and error reason.
The AUTO_PERR routine enables the user to program failure reactions, which may include,
for example, manipulating certain outputs, stopping the motor, or emitting a CAN
emergency. The AUTO_PERR can return the last error by using the PrgErr(N) function
(described in
section
If, after taking emergency steps, the AUTO_PERR is to resume the user program, the
following cautions should be taken:
A return command will resume execution at the next user program instruction. In most
cases, after the unexpected failure of a previous instructions, this should be avoided.
Because the depth of the program stack is unknown at the time of failure, jumping to an
absolute address should be carried out only after the reset command has reset the call
stack.
The AUTO_PERR routine automatically blocks all other auto-routines; therefore, the MI
command should be used to restore reaction to them.
The exit keyword can be used to exit the user program.
5.6.2
Expected Fault
Certain places in the user program are prone to faults; for example, a user program may fail
to start a motor due to an externally-activated switch. To react to an expected fault, a try-
catch block (
section
) should be used.
5.7
Program Flow Commands
The
SimplIQ
drive uses a set of commands to manage the flow of the user program. With
these commands, the user program can make decisions iterate or respond automatically to
certain events. The program flow commands enable user programs to perform much more
complicated functions than just running a set of commands sequentially.
The program flow commands are:
while - end
Iterate as long as condition is satisfied.
until
Iterate (suspend program execution) until condition is
satisfied.
wait
Iterate (suspend program execution) until a specified time
elapses.
for - end
Iterate for a number of counted times.
break
Break an iteration or a switch expression (for, while, switch)