App - 6 App - 6
MELSEC-Q
APPENDIX
Appendix 2 Precautions on Interrupt Processing
It is possible to activate an interrupt processing routine by the following causes in
AD51H-BASIC.
1) Starting up a subroutine due to an interrupt from one of the communication devices
connected to the various interfaces of the communication module (ON COM
GOSUB instruction)
2) Executing an error handling routine when an error occurs (ON ERROR GOTO
instruction)
Since the two types of interrupt processing routines above perform the processing
when an interrupt occurs due to the occurrence of their respective cause, it is
impossible to tell at which position in the program the interrupt processing routine is
executed.
Therefore, if an interrupt processing routine contains instructions to display characters
or the ZIDV and ZODV instructions that switch the console, the settings of the
character display position and the console switching may become disrupted as shown
in the example below.
Create the program in such a way that characters are not displayed or the console
switched during the interrupt processing routine.
Example
This example shows a case where characters are displayed during an interrupt
processing.
100 REM Interrupt processing
5 digits
Line 10
Program normal
5 digits
Line 10
Program normal
Line 20
An interrupt from the
RS-232C interface (1)"
Program normal
This is what
is displayed
normally.
The PRINT instruction in line 60 is executed
here due to the LOCATE instruction in line 110
and the PRINT instruction in line 120.
10 ON COM (1) GOSUB 100
20 COM (1) ON
50 LOCATE 5, 10
60 PRINT "Program normal"
90 GOTO 30
110 LOCATE 5, 20
120 PRINT "An interrupt from the RS-232C interface (1)"
130 RETURN
The execution restarts from
the instruction immediately
after the line where
the interrupt occurred.
Cause of
interrupt