Parker Automation Gemini GV6K Command Reference Manual page 148

Servo drive/controller
Table of Contents

Advertisement

Example:
DEF simple
; Begin definition of program
MC0
; Preset positioning mode
D50000
; Distance is 50000
A10
; Acceleration is 10
AD10
; Deceleration is 10
V5
; Velocity is 5
GOBUF1
; 1st motion segment
D30000
; Distance is 30000
V2
; Velocity is 2
GOBUF1
; 2nd motion segment
D40000
; Distance is 40000
V4
; Velocity is 4
GOBUF1
; 3rd motion segment
END
; End program definition
PCOMP simple ; Compile simple
PRUN simple ; Run simple
GOSUB
Call a Subroutine
Type
Program; Subroutine Definition; Program Flow Control
Syntax
<a_><!>GOSUB<t>
Units
t = text (name of program/subroutine)
Range
Text name of 6 characters or less
Default
n/a
Response
n/a
See Also
$, BREAK, DEF, DEL, END, ERASE, GOTO, JUMP, RUN
The
command branches to the corresponding program/subroutine name when executed. A subroutine
GOSUB
name consists of 6 or fewer alpha-numeric characters. The subroutine that the
control to the line after the
GOSUB
entered, no branch will occur, and processing will continue with the line after the
If you do not want to use the
simply use the subroutine name without the
If a subroutine is executed, and a
calling program or subroutine immediately.
Up to 16 levels of subroutine calls can be made without receiving an error.
Example:
DEF prog1
; Begin definition of program prog1 to be used as a subroutine
COMEXC0
; Disable continuous command processing mode
A10
; Set acceleration to 10 revs/sec/sec
V1
; Set velocity to 1 rev/sec
D4000
; Set distance to 4000 counts
L10
; Loop 10 times
GO1
; Initiate motion
GOSUB prog2
; GOSUB to program prog2 as a subroutine
LN
; End loop
END
; End subroutine definition of program proga
DEF prog2
; Begin definition of program prog2
OUT1
; Turn on output #1
T1
; Time delay of 1 second
OUT0
; Turn off output #1
END
; End subroutine definition of program prog2
RUN prog1
; Execute program prog1
; After program prog1 is initiated, and the first move of 4000 counts is complete, a
; GOSUB will occur causing the execution of program prog2. After program prog2
; finishes, control will be passed back to program prog1, to the command immediately
; following the GOSUB.
146
Gemini GV6K/GT6K Command Reference
, when the subroutine completes operation. If an invalid subroutine name is
command before the subroutine name (
GOSUB
attached to it (
GOSUB
command is received, the subroutine will return control to the
BREAK
www.comoso.com
The resulting profile from this program:
v
D50000
5
4
3
2
D30000
1
0
initiates will return
GOSUB
GOSUB
GOSUBsubname
).
subname
D40000
t
Product
Rev
GT6K
6.0
GV6K
6.0
.
), you can

Advertisement

Table of Contents
loading

This manual is also suitable for:

Gemini gt6k

Table of Contents