A SERVICE OF

logo

Danaher Motion 06/2005 Error Handling
M-SS-005-03 Rev E 159
11.1.1.2. TRY/FINALLY
Unlike an OnError block, the Try/Finally block may appear anywhere in the
main program section of the task. It can be used to take specific action with
relation to a particular area of your program code. This type of error handler
block only traps synchronous errors in the task context. The block is started
using the Try keyword and is terminated with the End Try keyword.
Try blocks can be nested. The program lines between the line causing the
error and the matching catch statement are skipped. The interpreter tries to
trap an error starting with the innermost catch statement. If there is no
matching catch statement, the error is handled as a regular synchronous
error. Errors trapped inside the Try block are not logged. The Finally
statement is executed only if an error occurred and was caught inside the
Try block.
11.1.2. System Context
System context is the lowest level of the three contexts. It refers to errors not
directly related to specific tasks. Errors that occur in this context affect all
running tasks. The default system error handler processes these errors.
Examples of system context errors include Floating Point Unit errors, CPU
errors, SERCOS communication errors and errors that occur on motion
elements not attached to specific tasks.
11.1.2.1. ONSYSTEMERROR
OnSystemError traps and processes all errors in the system context. It is the
upper-level of the hierarchical error processing structure formed by the
combination of Try, OnError and OnSystemError. OnSystemError may be
written in the body of any task, but only one instance may exist in the system
at any time. It traps both synchronous and asynchronous errors in all tasks,
as well as errors that occur within the context of the system.
A system error is not associated with a specific task. An example of a system
error is a position following error that occurs due to some external force
being applied to an axis not attached to a task. When an error is trapped, the
specified error processing code runs and the task is stops. The task is in
state 4. It is possible to continue task execution by explicitly entering
CONTINUETASK within the error processing code, but the task continues
only after the error has been corrected.
OnSystemError traps errors not specifically trapped by Try or by OnError. It
then executes either an orderly shutdown of the system, or an orderly
recovery procedure.
11.1.2.2. ERRORPRINTLEVEL
SYSTEM.ERRORPRINTLEVEL controls which types of system errors are
printed to the message log window. There are four levels of system errors:
fatal faults, errors, and notes.
0 (SILENTLEVEL) – Notes, errors, and fatal faults are not printed.
1 (FAULTLEVEL) – Notes and errors are not printed. Fatal faults are printed.
2 (ERRORLEVEL) – Notes are not printed. Errors and fatal faults are printed.
3 (NOTELEVEL) – Notes, errors, and fatal faults are printed.