11 - 64 11 - 64
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
ERR
Function
ERRor code
• Returns the error code of the detected error.
Syntax
ERR
Examples
E=ERR
• • • •
Stores the code of the detected error in E.
Description
• The ERR function returns the code of the detected error when an error occurs.
• The ERR function is used in the error processing routine so that the processing branches
depending on the error content.
• The ERR function has a limited purpose and it cannot be specified on the left side of the
equal sign in the LET instruction and some other places.
• For the error codes, see Appendix 4.4.
Program Example
10 ' Displays the error code
20 ON ERROR GOTO 100
:
' Branches to line 100 when an error occurs
50 ERROR 10
:
' <-- An error of error code 10 occurs
60 END
100 PRINT "ERROR CODE =";ERR
:
' Displays the error code
110 RESUME 60
RUN
ERROR CODE = 10
OK
REMARK
See the ON ERROR GOTO and RESUME instruction, ERL function, and Chapter 9.