11 INSTRUCTIONS AND FUNCTIONS
ON COM GOSUB
• Defines the starting line of the processing routine to be branched to when an interrupt
occurs from a communication line.
ON COM(<channel number>) GOSUB <line number>
Syntax
channel number
line number
ON COM (1) GOSUB 1000
Examples
• The ON COM GOSUB instruction defines the starting line of the processing routine to be
Description
branched to when an interrupt is generated from a communication line.
• The following values can be specified as <channel number>.
• If the command currently being executed involves waiting for external input, such as the
INPUT instruction, the branch processing will not be executed until the current command
is finished, even if an input interrupt occurs from a communication line.
• In the same way as usual subroutines, the returning from the processing routine is carried
out by using the RETURN instruction. If RETURN is entered alone, the execution starts
from the instruction next to the ON COM GOSUB instruction. If RETURN is entered along
with a line number, the execution starts from the specified line.
11 - 157
Instruction
1 • • • • CH1 (RS-232C)
2 • • • • CH2 (RS-232C)
3 • • • • CH3 (RS-422/485)
ON COMmunication GO to SUBroutine
• • • •
Specify the communication line to generate the
interrupt.
• • • •
Specify the line number to be processed after the
interrupt.
• • • •
Branches to line 1000 if an input interrupt is
generated from the communication line CH1 (RS-
232C).
MELSEC-Q
11 - 157