User's Manual

PMAC User Manual
204 Writing Programs for PMAC
G, M, T, and D-Codes
When PMAC encounters the letter G with a value in a motion program, it treats the command as a CALL
to motion program 10n0, where n is the hundreds’ digit of the value. The value without the hundreds’
digit (modulo 100 in mathematical terms) controls the line label within program 10n0 to which operation
will jump — this value is multiplied by 1000 to specify the number of the line label. When a return
statement is encountered, it will jump back to the calling program.
For example, G17 will cause a jump to N17000 of PROG 1000; G117 will cause a jump to N17000 of
PROG 1010; G973.1 will cause a jump to N73100 of PROG 1090.
M-codes are the same, except they use PROG 10n1; T-codes use PROG 10n2; D-codes use PROG 10n3.
Most of the time, these codes have numbers within the range 0 to 99, so only PROGs 1000, 1001, 1002,
and 1003 are required to execute them. To extend code numbers past 100, PROGs 1010, 1011, etc., will
be required to execute them.
The manufacturer's task is to write routines for motion programs 10n0 to 10n3 to implement the codes in
the manner desired. Once this is done, the method of implementation is invisible to the part programmers
and machine operators.
Standard G-Codes
These are the issues involved in implementing some of the more common G-codes:
G00 — Rapid Point-to-Point Positioning
Typically, this code is implemented in PMAC through use of the RAPID command. Many will have only
RAPID RETURN as the implementation of this code. (Since this is a call to N0 of PROG 1000, and the
N0 label is implied automatically by the beginning of any motion program, do not explicitly add an N0;
this routine must be at the very top of PROG 1000.)
If utilizing an external feedrate override signal, and the override should be disabled during RAPID mode,
set the time base source address variable back to its default value and away from the external source (e.g.
I193=2054). Alternately, this variable could be set to another external source if the machine had a
separate rapid override setting.
The section of the file to implement G00 would look something like:
CLOSE
OPEN PROG 1000
CLEAR ; To erase old version when sending new
RAPID ; First actual line of program
I193=2054
RET
G01 — Linear Interpolation Mode
Typically, this code is implemented in PMAC through use of the LINEAR command. The simplest
implementation of this is N01000 LINEAR RET. If feedrate override is desired, and it could have been
disabled in RAPID mode, the subroutine should set the time-base source address variable to the register
containing the external information (e.g. I193=1833).
G02 — 2D Clockwise Arc Mode
Typically, this code is implemented in PMAC through use of the CIRCLE1 command. The simplest
implementation of this is N02000 CIRCLE1 RET. If feedrate override is desired, and it could have
been disabled in RAPID mode, the subroutine should set the time-base source address variable to the
register containing the external information (e.g. I193=1833).