EasyManua.ls Logo

Tormach PCNC 770 - Defining a Subroutine

Tormach PCNC 770
230 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 7
138
UM10350_PCNC770_Manual_0916A
Programming
The subroune keyword denes the acon associated with the subroune label. Valid subroune
keywords and their meanings are detailed in the following table.
Subroutine Keyword Meaning
Sub Begin subroutine denition
Endsub End of subroutine denition
Call Call the subroutine
Do/while/endwhile Execute the subroutine while a condition is true
Repeat/endrepeat Execute the subroutine while a condition is true
If/elseif/else/endif Conditionally execute the subroutine
Break Break out of a while or if/elseif statement
Continue Skip remaining code and restart at top of while or repeat loop
Return Return a value
7.10.1.1 Defining a Subroutine
The sub and endsub keywords are used to dene the beginning and end a subroune. All lines of
code between the sub and endsub keywords are considered to be part of the subroune.
Sub, Endsub, Call Example:
o100 sub
G53 G00 X0 Y0 Z0 (rapid move to machine home)
o100 endsub
...
o100 call (call the subroutine here)
M02
Subrounes can either be dened in the program le or in a separate le. If the subroune is dened
in the same le as the main program that calls the subroune, it must be dened before the call
statement. For instance, this is valid:
o100 sub
G53 G00 X0 Y0 Z0 (rapid move to machine home)
o100 endsub
...
o100 call (call the subroutine here)
M02
But this is not:
o100 call (call the subroutine here)
M02
o100 sub
G53 G00 X0 Y0 Z0 (rapid move to machine home)
o100 endsub
...

Table of Contents

Other manuals for Tormach PCNC 770

Related product manuals