Description
The "Get error ID locally" instruction is used to query the occurrence of errors within a block. This is usually to access error. If the system reports during the block processing errors within the block execution since the last execution of the instruction, the error ID of the first error that occurred in the tag is stored at the ID output.
Only operands of the WORD data type can be specified at the ID output. If several errors occur in the block, the error ID of the next error to occur in the instruction is output only after the first error that occurred has been remedied.
|
Note The ID output is only changed if error information is present. To set the output back to "0" after handling an error, you have the following options:
|
The enable output ENO of the instruction "Get error ID locally" instruction is set only if the enable input EN returns signal state "1" and error information is present. If one of these conditions is not fulfilled, the remaining program execution is not affected by the "Get error ID locally" instruction.
You can find an example of how you can implement the instruction in combination with other troubleshooting options under "See also".
|
Note The "Get error ID locally" instruction enables local error handling within a block. If the "Get error ID locally" instruction is inserted in the program code of a block, any predefined system reactions are ignored if errors occur. |
Options for error handling
You can find an overview of the options for error handling here:Overview of mechanisms for error handling
For a detailed example of local error handling that contains several error handling options, refer to: Example of how to handle program execution errors
Parameters
The following table shows the parameters of the "Get error ID locally" instruction:
|
Parameters |
Declaration |
Data type |
Memory area |
Description |
|---|---|---|---|---|
|
EN |
Input |
BOOL |
I, Q, M, D, L or constant |
Enable input |
|
ENO |
Output |
BOOL |
I, Q, M, D, L |
Enable output |
|
ID |
Output |
WORD |
I, Q, M, D, L |
Error ID |
Parameter ID
The following table shows the values that can be output at the ID parameter:
|
ID* |
ID* |
Description |
|---|---|---|
|
0 |
0 |
No error |
|
2503 |
9475 |
Invalid pointer |
|
2520 |
9504 |
Invalid STRING |
|
2522 |
9506 |
Read error: Operand outside the valid range |
|
2523 |
9507 |
Write error: Operand outside the valid range |
|
2524 |
9508 |
Read error: Invalid operand |
|
2525 |
9509 |
Write error: Invalid operand |
|
2528 |
9512 |
Read error: Data alignment |
|
2529 |
9513 |
Write error: Data alignment |
|
252C |
9516 |
Invalid pointer |
|
2530 |
9520 |
Write error: Data block |
|
2533 |
9523 |
Invalid reference used |
|
2538 |
9528 |
Access error: DB does not exist |
|
2539 |
9529 |
Access error: Wrong DB used |
|
253A |
9530 |
Global data block does not exist |
|
253C |
9532 |
Faulty information or the function does not exist |
|
253D |
9533 |
System function does not exist |
|
253E |
9534 |
Faulty information or the function block does not exist |
|
253F |
9535 |
System block does not exist |
|
2550 |
9552 |
Access error: DB does not exist |
|
2551 |
9553 |
Access error: Wrong DB used |
|
2575 |
9589 |
Error in the program nesting depth |
|
2576 |
9590 |
Error in the local data distribution |
|
2577 |
9591 |
The block property "Parameter passing via registers" is not selected. |
|
25A0 |
9632 |
Internal error in TP |
|
25A1 |
9633 |
Tag is write-protected |
|
25A2 |
9634 |
Invalid numerical value of tag |
|
2942 |
10562 |
Read error: Input |
|
2943 |
10563 |
Write error: Output |
|
* The error codes can be displayed as integer or hexadecimal values in the program editor. You can find information on switching the display formats under "See also". |
||
Example
The following example shows how the instruction works:
An error occurred accessing the #Field[#index] tag. The enable output ENO of the "Multiply" instruction and the #TagOut_Enabled operand have signal state "1" despite the read/access error and the multiplication is performed with the value "0.0". If this error scenario occurs, it is recommended to program the "Get error ID locally" instruction after the "Multiply" instruction to get the error. The error information supplied by the "Get error ID locally" instruction is evaluated with the comparison instruction "Equal". If the #TagID operand returns the ID 2522, this involves a read/access error and the value "100.0" is written to the #TagOut output.