Reference Manual

PMAC 2 Software Reference
PMAC Program Command Specification 301
CALL
Function
Jump to Subprogram With Return
Type
Motion program (PROG and ROT)
Syntax
CALL{data} [{letter}{data}...]
where:
the first {data} is a floating-point constant or expression from 1.00000 to
32767.99999, with the integer part representing the motion program number to be
called, and the fractional part representing the line label (N or O) within the program
to be called (the line label number is equal to the fractional part multiplied by
100,000; every motion program has an implicit N0 at the top).
{letter} is any letter of the English alphabet, except N or O, representing the
variable into which the value following it will be placed (Q101 to Q126 for A to Z
respectively).
following {data} is a floating-point constant or expression representing the value
to be put into the variable.
Remarks
This command allows the program to execute a subprogram and then return execution to
the next line in the program. A subprogram is entered into PMAC the same as a
program, and is labeled as PROGn (so one program can call another as a subprogram).
The number n of the PROG heading is the one to which the value after CALL refers:
CALL7 would execute PROG7 and return.
The value immediately following CALL can take fractional values. If there is no
fractional component, the called program starts at the beginning. If there is a fractional
component, the called program is entered at a line label specified by the fractional
component (if this label does not exist, PMAC will generate an error and stop execution).
PMAC works with five fractional digits to specify the line label; if fewer are used, it
automatically fills out the rest with zeros. For instance, CALL 35.1 is interpreted as
CALL 35.10000, which causes a jump to label N10000 of program 35. CALL
47.123 causes a jump to label N12300 of program 47.
If letters and data (e.g. X1000) follow the CALL{data}, these can be arguments to be
passed to the subprogram. If arguments are to be passed, the first line executed in the
subroutine should be a READ statement. This statement will take the values associated
with the specified letters and place them in the appropriate Q-variable. For instance, the
data following A is placed in variable Q101 for the coordinate system executing the
program; that following B is placed in Q102; and so on, until the data following Z is
placed in Q126. The subprogram can then use these variables.
If the subprogram calls another subprogram with arguments, the same Q-variables are
used. Refer to READ for more details.
If there is no READ statement in the subroutine, or if not all the letter values in the CALL
line are read (the READ statement stops as soon as it sees a letter in the calling line that is
not in its list of letters to read), the remaining letter commands are executed upon return
from the subroutine. For example, G01 X10 Y10 is equivalent to a CALL 1000.01
X10 Y10. To implement the normal function for G01 (linear move mode), there would
be the following subroutine in PROG 1000:
N1000 LINEAR RETURN