Reference Guide

PMAC Quick Reference Guide
Motion Programs 43
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 eight). 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 similar to 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 be used conveniently. 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.
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 in 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 Spline 1 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).