User's Manual

PMAC User Manual
Writing Programs for PMAC 165
WRITING PROGRAMS FOR PMAC
Writing a Motion Program
PMAC can hold up to 256 motion programs at one time. Any coordinate system can run any of these
programs at any time, even if another coordinate system is already executing the same program. PMAC
can run as many motion programs simultaneously as there are coordinate systems defined on the card (up
to eight). A motion program can call any other motion program as a subprogram, with or without
arguments.
The PMAC motion program language is perhaps best described as a cross between a high-level computer
language like BASIC or Pascal, and G-Code (RS-274) machine tool language. In fact, it can accept
straight G-Code programs directly (provided it has been set up properly). It has the calculational and
logical constructs of a computer language, and move specification constructs very much like machine tool
languages. Numerical values in the program can be specified as constants or expressions.
Flow Control
In a motion program, PMAC has WHILE loops and IF..ELSE branches that control program flow.
These constructs can be nested indefinitely. In addition, there are GOTO statements, with either constant
or variable arguments (the variable GOTO can perform the same function as a Case statement). GOSUB
statements (constant or variable destination) allow subroutines to be executed within a program. CALL
statements permit other programs to be entered as subprograms. Entry to the subprogram does not have
to be at the beginning — the statement CALL 20.15000 causes entry into Program 20 at line N15000.
GOSUBs and CALLs can be nested only 15 deep.
G-Codes
To handle machine tool G-codes, PMAC treats Gnn as CALL 1000.nn000. The following values on
the line (e.g. X1000) can be treated as parameters to be passed, as for a canned cycle, or the subprogram
can execute without arguments, return, and execute the rest of the line (as for a modal G-code). The
machine tool designer writes Program 1000 to implement the G-codes as he wishes, allowing
customization and enhancements. Delta Tau provides a sample file implementing all of the standard G-
codes. M, S, T, and D codes are similarly implemented.
Modal Commands
Many of the statements in PMAC motion programs are modal in nature. These include move modes,
which specify what type of trajectory a move command will generate; this category includes LINEAR,
RAPID, CIRCLE, PVT, and SPLINE. Moves can be specified either incrementally (distance) or
absolutely (location) – individually selectable by axis – with the INC and ABS commands. Move times
(TA, TS, and TM) and/or speeds (F), are implemented in modal commands. Modal commands can
precede the move commands they are to affect, or they can be on the same line as the first of these move
commands.
Move Commands
The move commands themselves consist of a one-letter axis-specifier followed by one or two values
(constant or expression). All axes specified on the same line will move simultaneously in a coordinated
fashion on execution of the line; consecutive lines execute sequentially (with or without stops in between,
as determined by the mode). Depending on the modes in effect, the specified values can mean
destination, distance, and/or velocity (see Trajectory Features section).