User`s manual
Programmed Motion
GFK-1742A Chapter 7 Programmed Motion 7-19
7
Single-axis Subroutine Structure
•
SUBROUTINE definition statement
. It must be the first line of the subroutine. It must
identify the subroutine number and contain the SINGLE-AXIS statement. For example:
SUBROUTINE 3 SINGLE-AXIS
•
Body
. The subroutine body contains the actual programmed commands. Note that in a
single-axis subroutine, you must not specify an axis number in any of the commands.
Doing so will generate an error. An example of correct syntax for a single-axis subroutine
command is:
ACCEL 50000
•
End of Subroutine
. Uses the ENDSUB statement. This statement clearly identifies the end
of the subroutine and helps separate one subroutine or program from another. The
ENDSUB should be the only thing on the last line of any subroutine:
ENDSUB
Single-Axis Subroutine Example
An axis number should not be specified in a single-axis subroutine. That is because a single-axis
subroutine will apply to the axis specified in the single-axis program that calls it. This allows a
subroutine to be used by different single-axis programs, regardless of the particular axis number
they specify.
SUBROUTINE 15 SINGLE-AXIS
ACCEL 50000
VELOC 10000
PMOVE 200000, ABS, LINEAR
DWELL 3000
PMOVE 50000, ABS, LINEAR
ENDSUB
Multi-Axis Subroutine Structure
•
SUBROUTINE definition statement
. It must be the first line of the subroutine. It must
identify the subroutine number and the fact that this is a multi-axis program by using the
MULTI-AXIS term. For example:
SUBROUTINE 7 MULTI-AXIS
•
Body
. The subroutine body contains the actual programmed commands. Note that in a
multi-axis subroutine, you must specify an axis number in many of the commands. Failure
to do so will generate an error. An example of correct syntax for a multi-axis subroutine
command is:
ACCEL AXIS2 50000