11 - 162 11 - 162
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
ON ERROR GOTO
Instruction
ON ERROR GOTO
• Enables interrupt processing if an error occurs and moves the execution to the starting line
of an error handling routine.
ON ERROR GOTO <line number>
Syntax
line number
• • • •
Specify the starting line number or label of the error
handling routine of the program that will be executed
if an error occurs.
Examples
ON ERROR GOTO 100
• • • •
Moves the execution to line 100 if an error occurs.
Description
• The ON ERROR GOTO instruction enables interrupt processing if an error occurs and
moves the execution to the start line of an error handling routine.
• A label name can be specified instead of a line number for <line number>.
• If the specified <line number> does not exist, an “Undefined line number” error occurs.
• Do not display characters or switch ports via the ZIDV or ZODV instruction in the error
handling routine.
Character display and input/output processing may not be performed correctly upon
returning to the main program, depending on the execution timing of the error handling
routine.
• Specify 0 for the value in <line number> before executing the program in order to disable a
previously enabled interrupt at error generation.
Then, if the program detects an error, it displays the error message and stops the
execution of the program.
• If "ON ERROR GOTO 0" is present in an error handling routine, the errors that have
occurred are displayed and the execution of the program stops.
• It is recommended to specify "ON ERROR GOTO 0" if an error that is not handled explicitly
in the error handling routine is detected.
• Use the RESUME instruction to return from the error handling routine.
• If an error occurs during the execution of an error handling routine, BASIC displays the
corresponding error message and the execution of the program stops.
Содержание 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...