9 - 1 9 - 1
MELSEC-Q
9 THE CONCEPT OF ERROR HANDLING
9
9 THE CONCEPT OF ERROR HANDLING
If an error occurs while running the BASIC program, an error message is displayed
and the program stops running.
ERROR !
If an error occurs,
the program no
longer runs
Although the program is usually created to generate a minimal amount of errors taking
as many potential causes into consideration as possible, errors may occur due to
causes that are normally difficult to foresee.
Creating an “error handling routine” in BASIC to deal with these kinds of errors will
allow the program to continue running without stopping and displaying an error
message.
9.1 Definition of Error Handling
Error handling routine is a routine performed when an error occurs. It is defined using
the ON ERROR GOTO instruction. By specifying a line number or label after the ON
ERROR GOTO instruction, the routine begins executing from the line specified by this
line number or label once an error occurs.
ON ERROR GOTO
RESUME
Error handling routine
Normal processing routine
In the error handling routine, appropriate corrective action for the error can be taken
using BASIC instructions.
Once the error handling is completed, normal processing can be resumed using the
RESUME instruction.
Once the error handling is completed, always return to normal processing using
the RESUME instruction. The error handling will not be performed if an error occurs
again in case the processing is resumed using an instruction such as GOTO.
REMARK
• To disable an error handling routine that has been defined, set ON ERROR GOTO
to 0. After this, an error message is displayed and the program stops if an error
occurs.
Содержание 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...