Mitsubishi MELFA CR1D Instruction Manual page 244

Table of Contents

Advertisement

4MELFA-BASIC IV
On Com GoSub (ON Communication Go Subroutine)
[Function]
Defines the starting line of a branching subroutine when an interrupt is generated from a designated com-
munication line.
[Format]
On[]Com[][(<File No.>)][]GoSub[]<Call Destination>
[Terminology]
<File No.>
<Call Destination> Describe the line No. and label name.
[Reference Program]
If an interrupt is generated from the file No. 1 communication line (COM1:), carry out the label RECV pro-
cess.
1 Open "COM1:" AS #1
2 On Com(1) GoSub *RECV
3 Com(1) On
4
:
10 ' <<If the communicative interrupt occurs here, it will branch to label *RECV.>>
11 '
12 Mov P1
13 Com(1) Stop
14 Mov P2
15 Com(1) On
16
:
22 ' <<If the communicative interrupt occurs here, it will branch to label *RECV.>>
23
24 Com(1) Off
25 Close #1
26 End
:
:
30 *RECV
31 Input #1, M0001
32 Input #1, P0001
:
39 Return 1
[Explanation]
(1) If the file No. is omitted, 1 will be used as the file No.
(2) The file Nos. with the smallest No. have the order of priority for the interrupt.
(3) If the communicative interrupt occurs while the robot is moving, robots operating within the same slot will
stop. It is possible to use Com Stop to stop the interrupt, and prevent the robot from stopping.
(4) Interrupts are prohibited in the initial state. To enable interrupts, execute the Com On instruction after this
instruction.
(5) Make sure to return from a subroutine using theReturn instruction. An error occurs if the GoTo instruction
is used to return, because the free memory available for control structure (stack memory) decreases
and eventually becomes insufficient.
[Related instructions]
Com On/Com Off/Com Stop (Communication
Print
(Print),
Close (Close)
4-231 Detailed explanation of command words
Describe a number between 1 and 3 assigned to the communication line.
' Communication line opening.
' The definition of interruption.
' Enable interrupt from file No. 1 communication line.
'
' Suspend the interrupt during movement only from P1 to P2.
' If there are some communications during movement from P1 to P2, the
interrupt occurs here.
'
'
' Disable interrupt from file No. 1 communication line.
' Communication interruption processing.
' Set the received information as M0001 and P0001.
' Returns control to the next step of interrupted step.
ON/OFF/STOP),
Return
(Return),
Open
(Open),
Input
(Input),

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melfa cr2dMelfa cr3d

Table of Contents