User's Manual

PMAC User Manual
Writing Programs for PMAC 207
The subroutine implementing G95 must therefore cause the program to get its time base from the spindle
encoder and get the constants of proportionality correct. (Actually, some or all of these constants may be
set up ahead of time.) This external time base function is performed through a PMAC software feature
known as the Encoder Conversion Table, which is documented in detail in the Feedback Features section
of the manual. Instructions for setting up an external time base are given in detail in Chapter 15,
Synchronizing PMAC to External Events.
Briefly, a scale factor between time and frequency must be set up in the conversion table that defines a
"real-time" input frequency (RTIF). The motion program then can be written as if it were always getting
this frequency. In our case, we will take a real- time spindle speed that is near or greater than our
maximum.
For example, we use 6000 rpm (100 rev/sec) as our real-time spindle speed. In "real time", one spindle
revolution takes 10 msec, so we want our feedrate to be in units of length per (10 msec), which we
achieve by setting Ix90 (feedrate time units) to 10. If we have 4096 counts per spindle revolution (after
decode) our RTIF would be 4096 x 100 = 409,600 cts/sec = 409.6 cts/msec. The equation for the
conversion table scale factor (SF) is:
SF = 131,072 / RTIF (cts/msec) = 131,072 / 409.6 = 320
This value must come out to an integer for true synchronization without any roundoff errors. Usually it is
easy if the spindle encoder has a resolution of a power of 2. If not, the real-time spindle speed in rps
should be a power of 2, and Ix90 would not be an integer.
This scale factor would be written to the appropriate register in the conversion table. In general, this
would not have to be done every time G95 is executed; rather, it would be part of the system setup.
The typical subroutine for G95 would consist of setting Ix93 and Ix90 for the coordinate system:
N95000 I190=10 ; PMAC F is length/ 10 msec
I193=1833 ; Time base source is external
RET
G96 — Constant Surface Speed Mode Enable
This code sets up the programs so that the spindle is put in constant surface speed (CSS) mode. In this
mode, the spindle angular velocity is varied in real time so that its surface speed past the tool tip remains
constant. Essentially, this means that the angular velocity of the spindle is inversely proportional to the
radial distance of the tool tip from the spindle center. Usually this distance is the X-axis position —
implying that the X-axis zero position is at the spindle center. Some G-code dialects allow the parts
program to create an X-axis offset with G92 R (q.v.), which defines what the radial distance is at the
current X-axis commanded position.
The method suggested here for CSS mode has the spindle in a separate PMAC coordinate system from
the other axes. This allows a spindle program to be executing and reacting at a different rate from the
main parts program, yet to be ultimately controlled by the parts program through variables and flags.
This type of spindle program is explained in detail below.
A G96 code will carry with it a spindle surface speed S code in either feet/minute or meters/minute. This
value should be placed in a variable for the spindle program to pick up. A flag should also be set noting
which mode the spindle is in. Note that spindle mode and speed can be set independently of spindle on/off
state and direction (for which see M03, M04, M05). A typical G96 routine using this approach would be:
N96000 READ(S) ; Read spindle surface speed into Q119
P96=Q119 ; Store spindle speed
M96=1 ; Flag to mark CSS mode
RETURN