Gosub To Return; 40 Gosub To Return - Omron SCARA YRCX Series Programming Manual

Robot controller
Hide thumbs Also See for SCARA YRCX Series:
Table of Contents

Advertisement

40

GOSUB to RETURN

8
Jumps to a subroutine
A
B
C
D
MEMO
E
F
G
H
I
J
K
L
M
8-66
Chapter 8 Robot Language Lists
Format
GOSUB label
:
label:
:
RETURN
Explanation
Jumps to the <label> subroutine specified by the GOSUB statement.
A RETURN statement within the subroutine causes a jump to the next line of the
GOSUB statement.
• The GOSUB statement can be used up to 120 times in succession. Note that this number of
times is reduced if commands containing a stack such as an FOR statement or CALL statement
are used.
• When a jump to a subroutine was made with the GOSUB statement, always use the RETURN
statement to end the subroutine. If another statement such as GOTO is used to jump out of the
subroutine, an error such as "5.212: Stack overflow" may occur.
SAMPLE
*ST:
MOVE P,P0
GOSUB *CLOSEHAND
MOVE P,P1
GOSUB *OPENHAND
GOTO *ST
HALT
'SUB ROUTINE
*CLOSEHAND:
DO(20) = 1
RETURN
*OPENHAND:
DO(20) = 0
RETURN
Related commands
RETURN
* GOSUB can also be expressed as "GO SUB".

Advertisement

Table of Contents
loading

Table of Contents