User`s manual

Page - 41
5.0 - Motion Programs
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 8). A motion program can call any other motion
program as a subprogram, with or without arguments.
PMAC's 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.
Motion or PLCs programs are entered in any text file to be downloaded afterwards to PMAC. PEWIN provides a built-in
text editor for this purpose but any other text editor could conveniently be used. Once the code has been written it can be
downloaded to PMAC using PEWIN.
All PMAC commands can be issued from any terminal window communicating with PMAC. Online commands allow, for
example, to jog motors, change variables, report variables values, start and stop programs, query for status information and
even write short programs and PLCs. In fact, the downloading process is just a sequence of valid PMAC commands sent
line by line from a particular text file.
5.1 - How PMAC Executes a Motion Program
Basically, a PMAC program exists to pass data to the trajectory generator routines that compute the series of commanded
positions for the motors every servo cycle. The motion program must be working ahead of the actual commanded move to
keep the trajectory generators "fed" with data.
PMAC processes program lines either zero, one or two moves (including DWELLs and DELAYs) ahead. Calculating one
move ahead is necessary in order to be able to blend moves together; calculating a second move ahead is necessary if proper
acceleration and velocity limiting is to be done, or a three-point spline is to be calculated (SPLINE mode).
For linear blended moves with I13 (move segmentation time) equal to zero (disabled), PMAC calculates two moves ahead,
because the velocity and acceleration limits are enabled here. In all other cases, PMAC is calculating one move ahead.
no moves ahead two moves ahead one move ahead
RAPID LINEAR with I13=0 LINEAR with I13>0
HOME SPLINE1 CIRCLE
DWELL PVT
b1s(step through the program)
Ix92=1 (blending disabled)
When a Run command is given, and every time the actual execution of programmed moves progresses into a new move, a
flag is set saying it is time to do more calculations in the motion program for that coordinate system. At the next RTI, if this
flag is set, PMAC will start working through the motion program processing each command encountered. This can include
multiple modal statements, calculation statements, and logical control statements. Program calculations will continue
(which means no background tasks will be executed) until one of the following conditions occurs:
1. The next move, a DWELL command or a PSET statement is found and calculated
2. End of, or halt to the program (e.g. STOP) is encountered
3. Two jumps backward in the program (from ENDWHILE or GOTO) are performed
4. A WAIT statement is encountered (usually in a WHILE loop)
If calculations stop on condition 1 or 2, the calculation flag is cleared, and will not be set again until actual motion
progresses into the next move (1) or a new Run command is given (2). If calculations stop on conditions 3 or 4, the flag
remains set, so calculations will resume at the next RTI. In these cases you have an "empty" (no-motion) loop, the motion
program acts much like a PLC 0 during this period
If PMAC ever cannot finish calculating the trajectory for a move by the time execution of that move is supposed to begin,
PMAC will abort the program, showing a run-time error in its status word.