User manual
  PMAC User Manual 
202  Writing Programs for PMAC 
If the logic of the subroutine needs to know whether a certain argument has been passed to it or not, it 
should use the bit-by-bit AND operator (&) between Q100 and the value of the bit in question. The value 
of bit 0 is 1, of bit 1 is 2, of bit 2 is 4, and so on (bit value is 2
N-1
, for the Nth letter of the alphabet). For 
instance, to see if a D-argument has been passed, the condition would be: 
IF (Q100 & 8 > 0) ... 
D is the fourth letter, so the bit value is 2
3
 = 8. To see if an S argument has been passed — S is the 19th 
letter, so the bit value is 2
18
= 262,144 — the condition would be: 
IF (Q100 & 262144 > 0) ... 
PRELUDE Subprogram Calls 
PMAC permits creation of an automatic subprogram call before each move command or other letter-
number command in a motion program or section of a motion program. If the subprogram starts with a 
READ command, then the move command or letter-number command itself is turned arguments for the 
subprogram call. This functionality is very useful for executing canned cycles in machine-tool style 
programs, or for turning ordinary move commands into arguments for a subprogram that executes inverse 
kinematic or similar calculations. 
This capability is accomplished through the motion-program PRELUDE command. To turn on the 
function, declare PRELUDE1 in the motion program, followed by the subprogram call you wish to be 
executed before each subsequent move command or letter-number command. This subprogram call can 
be declared with a CALL command, or a G, M, T, or D-code, any of which is a special subprogram call. In 
a PRELUDE1 declaration the value in the subprogram call specifying which subprogram and which line 
must be a constant; it cannot be a variable or expression. 
Once PMAC has encountered a PRELUDE1 command in the program, it will execute the specified 
subprogram call each time it encounters a move command or other letter-number command in the motion 
program (including G, M, T, and D codes, but excluding N and O line labels). The move command or 
letter-number command must be at the beginning of a program line, or immediately following an N or O 
line label at the beginning of a program line. 
Once PMAC has jumped to the subprogram specified by PRELUDE1, it will treat any move command or 
letter-number command in the subprogram as it normally would; these will not cause another subprogram 
call automatically. Automatic PRELUDE subprogram calls therefore cannot be nested within each other; 
however, a single PRELUDE subprogram call may be nested within explicit subroutine and subprogram 
calls, and explicit subroutine and subprogram calls may be nested with a single automatic PRELUDE 
subprogram call. 
A new PRELUDE1 command supersedes the existing PRELUDE1 command. A PRELUDE0 command 
(no arguments necessary) turns off the PRELUDE function. 
Running a Motion Program 
Once the motion program has been entered and the program buffer closed, execute the motion program. 
Since PMAC can store multiple programs at once, the first thing to do is to tell the PMAC coordinate 
system which program to run (remember that it is a coordinate system in PMAC that executes a motion 
program; different coordinate systems may be executing other motion programs at the same time). 










