
User Manual
Chapter 7
GFK-1742F
Jan 2020
Programmed Motion
189
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
•
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
Multi-Axis Subroutine Example
SUBROUTINE 2 MULTI-AXIS
ACCEL AXIS2 P100
VELOC AXIS2 P105
2:
SYNC
CMOVE AXIS2 P001, INCR, S-CURVE
DWELL AXIS2 P001
JUMP CTL01, 2
PMOVE AXIS2 P214, ABS, LINEAR
ENDSUB