How To Determine The Type Of Error And The Location Where The Error Occurred - Mitsubishi QD51 Programming Manual

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

9 THE CONCEPT OF ERROR HANDLING

9.2 How to Determine the Type of Error and the Location where the Error Occurred

The type of error and the line number where it has occurred can be determined by
using the following two functions in the error handling routine.
• ERR function Gives the error code for the generated error.
• ERL function Gives the line number where the error occurred
The ERL function is used to determine the line of
the program where the error occurred.
The ERR function gives the type of error as an error code. See the error code table in
Appendix 5.4 for the correspondence between the error type and error code.
The generated error can be determined in detail by combining the ERR and ERL
functions.
The error handling routine is branched according to these functions, in order to perform
the correct processing for the generated error.
Example
9 - 2
The ERR function is used to determine
the type of generated errors.
5 ON ERROR GOTO 100
10 INPUT "X=" ;X
20 INPUT "Y=" ;Y
30 A=EXP (X) :PRINT "EXP (X)=" ;A
40 B=10^Y :PRINT "10^Y=" ; B
50 END
100 IF ERR=6 AND ERL=30 THEN
PRINT "Choose a smaller X"
110 IF ERR=6 AND ERL=40 THEN
PRINT "Choose a smaller Y"
120 RESUME 10
RUN
X=?100
Y=?2
"Choose a smaller X"
X=?2
Y=?2
EXP (X)=7.38906
10^Y=100
OK
MELSEC-Q
This is the judgment when an
Overflow error occurs at line 30.
This is the judgment when an
Overflow error occurs at line 40.
9
9 - 2

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents