Error Handling
06/2005
Danaher Motion
162 Rev
E
M-SS-005-03l
3.
Reset the WatchDog with an API command based on a timer. Run the
following Visual BASIC code once upon initialization:
Include KMAPI.BAS in your project
KMExecuteCmd(MC, “MyVar=WDInit(5)”)
KMExecuteCmd(MC, “WDCycle(MyVar)”)
4.
Run the following Visual BASIC code from a timer set for 50 ms:
KMEXecuteEmd(MC, “WDCycle(MyVar)”)
11. 3
UEA (U
SER
E
RROR
A
SSERTION
)
The purpose of
U
ser
E
rror
A
ssertion (UEA) is to let the application developer
extend existing system (internal) errors. You can define application
(additional) errors (exceptions) so the system handles them like it would its
own. The application exception may be trapped with
TRY/Catch
,
OnError
or
OnSystemError
. Unprocessed application exceptions are treated as any
known internal error. The system reacts by stopping the task/motion
according to exception severity. The system provides a range for the
application errors and prevents an overlap between internal and application
error codes. The application is able to define an exception name and ASCII
message to print. User exceptions start from number 20001 and you are able
to define 1000 exceptions. UEA may have “Note” and “Error” seventies.
11. 4
E
XCEPTIONS
11.4.1. Declaration
The application developer can declare an exception and supply the
corresponding error message. An exception may be declared on the both
system and task levels. Declaration of exceptions at the subroutine level is
not supported. User exceptions are divided into two sub ranges 20001-
20499 and 20500-20999. Applications developed may use the first sub range
for explicit definitions of exception number (see below example), while the
second sub range is used by the system for automatic assignment of
exception numbers. Double use of the same exception number is forbidden
as the System gives an error. The exception can be defined with the
following declaration:
Dim|common shared <
name
> as <
severity
> <
ASCII message
> [<
num
>]
where:
Parameter Description
Remarks
Severity Note/Error
Num
(optional parameter)
Integer number 20001..20499, which will
be assigned to exception. This parameter
is optional, if omitted the system will assign
some value in range 20500..20999. MC will
report an error if number given by the
application developer is already used.
ACII Msg
ASCII text that will appear at error history
and error message.
For example:
Dim shared Error1 as Note ”Emergency” 20001
Dim shared Error2 as Note ”Fault” 20002
Common shared MyNote as Note ”My Note”
Common shared MyError as Error ”My Error”