EasyManua.ls Logo

Tormach PCNC 440 - 7.8.1.2 Calling a Subroutine

Tormach PCNC 440
183 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
149
UM10372_PCNC440_Manual_0221A
PROgRAMMiNg
A subroune can be a separate le, provided the following rules are obeyed:
The le must be named the same as your call
The le must include a sub and endsub in the le
The le must be in the directory Subrounes
The le name can include lowercase leers, numbers, dashes, and underscores only
The le can contain only a single subroune denion
The le must end with the extension .nc
7.8.1.2 Calling a Subroutine
To execute a subroune in a program, it must be called. To call a subroune, program O~ call where
~ is the subroune name. The subroune name may be either a named le, a numbered le, or an
expression that evaluates to a valid subroune label.
Expression Example: o[#101+2] call
Named File Example: o<myle> call
Numbered File Example: o123 call
Oponal Arguments to O~call
O~ call takes up to 30 oponal arguments, which are passed to the subroune as #1, #2 , . . . , #N.
Unused parameters from #N+1 to #30 have the same value as in the calling context.
Parameters #1-#30 are local to the subroune. On return from the subroune, the values of
parameters #1 through #30 (regardless of the number of arguments) are restored to the values they
had before the call.
The following calls a subroune with three arguments:
O~ Call Example: o200 call [1] [2] [3]
Because 1 2 3 is parsed as the number 123, the parameters must be enclosed in square brackets.
Subroune bodies may be nested. Nested subrounes may only be called aer they are dened.
They may be called from other funcons, and may call themselves recursively if it makes sense to
do so. The maximum subroune nesng level is 10.
Subrounes do not have return values, but they may change the value of parameters above #30
and those changes are visible to the calling G-code. Subrounes may also change the value of global
named parameters.
NOTE: File names are lowercase leers only; o<MyFile> is converted to o<myle> by the interpreter.

Table of Contents

Other manuals for Tormach PCNC 440