9 - 2 9 - 2
MELSEC-Q
9 THE CONCEPT OF ERROR HANDLING
9
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.
ERR
The ERR function is used to determine
the type of generated errors.
• ERL function
Gives the line number where the error occurred
ER L
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
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
This is the judgment when an
Overflow error occurs at line 30.
This is the judgment when an
Overflow error occurs at line 40.
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...