Escolar Documentos
Profissional Documentos
Cultura Documentos
Instruction
Advanced RAPID
Example
VAR errdomain err_domain;
VAR num err_number;
VAR errtype err_type;
VAR trapdata err_data;
VAR string string1;
VAR string string2;
...
TRAP trap_err
GetTrapData err_data;
ReadErrData err_data, err_domain, err_number,
err_type \Str1:=string1 \Str2:=string2;
ENDTRAP
When an error is trapped to the trap routine trap_err, the error domain, the error
number, the error type and the two first intermixed strings in the error message
are saved into appropriate variables.
Arguments
ReadErrData TrapEvent ErrorDomain ErrorId ErrorType [\Str1]
[\Str2] [\Str3] [\Str4] [\Str5]
TrapEvent
Variable containing the information about what caused the trap to be executed.
ErrorDomain
The error domain to which the error, state change, or warning that occurred
belongs. Ref. to predefined data of type errdomain.
ErrorId
335
ReadErrData
Advanced RAPID
Instruction
ErrorType
The type of event such as error, state change, or warning that occurred.
Ref. to predefined data of type errtype.
[ \Str1 ] ... [ \Str5 ]
The string holding information that is intermixed into the error message. There
could be up to five strings in a message. Str1 holds the first string, Str2 holds the
second string and so on. Information about how many strings there are in a message is found in User Guide - Error Management, System and Error Messages.
The intermixed string are maked as %s, %d or %f in that document.
Program execution
The ErrorDomain, ErrorId, ErrorType and Str1 ... Str5 variables are updated according
to the contents of TrapEvent.
If different events are connected to the same trap routine, the program must make sure
that the event is related to error monitoring. This can be done by testing that INTNO
matches the interrupt number used in the instruction IError;
Example
VAR intnum err_interrupt;
VAR trapdata err_data;
VAR errdomain err_domain;
VAR num err_number;
VAR errtype err_type;
...
CONNECT err_interrupt WITH trap_err;
IError COMMON_ERR, TYPE_ERR, err_interupt;
...
IDelete err_interrupt;
...
TRAP trap_err
GetTrapData err_data;
ReadErrData err_data, err_domain, err_number, err_type;
! Set domain no 1 ... 13
SetGO go_err1, err_domain;
! Set error no 1 ...9999
SetGO go_err2, err_number;
ENDTRAP
When an error occurs (only errors, not warning or state change), the error number
is retrieved in the trap routine and its value is used to set 2 groups of digital outputs.
336
ReadErrData
Instruction
Advanced RAPID
Limitation
It is not possible obtain information about internal errors.
Syntax
ReadErrData
[TrapEvent :=] <variable (VAR) of trapdata>,
[ErrorDomain :=] <variable (VAR) of errdomain>,
[ErrorId:=] <variable (VAR) of num>,
[ErrorType :=] <variable (VAR) of errtype>
[\Str1 :=<variable (VAR) of string>]
[\Str2 :=<variable (VAR) of string>]
[\Str3 :=<variable (VAR) of string>]
[\Str4 :=<variable (VAR) of string>]
[\Str5 :=<variable (VAR) of string>];
Related information
Described in:
Summary of interrupts
Instructions - IError
Instructions - GetTrapData
337
ReadErrData
Advanced RAPID
338
Instruction