User's Manual

PMAC User Manual
208 Writing Programs for PMAC
G97 — Constant Surface Speed Disable
This code cancels spindle constant surface speed mode and puts the spindle into a constant angular
velocity mode. In this mode, the spindle speed is independent of tool radial position. With the spindle
axis in a separate coordinate system, the subroutine executing this code simply sets a variable and a flag
for that program to see. Usually, a G97 code will carry with it a spindle speed S code in RPM. If it does,
the routine picks it up and puts it into a variable. If it does not, the routine allows the spindle program to
keep its last RPM computed under G96 from surface speed and radial distance. A typical G97 routine
using this approach would be:
N97000 READ(S) ; Read spindle RPM into Q119
IF (M100 & 262144 > 0) P97=Q119 ; Store for spindle prog
M96=0 ; Cancel CSS mode
Spindle Programs
Controlling the spindle axis in PMAC may be done in different ways, depending on what the spindle
needs to do. The simplest type of spindle operation, of course, is the one in which the spindle is simply
asked to move at constant speeds for substantial periods of time in one direction or another. In this case,
there is no need to write a spindle motion program; either PMAC just puts out a voltage proportional to
speed (so the spindle is open-loop as far as PMAC is concerned), or the spindle motor is jogged (under
PMAC closed-loop control).
Jogged Spindle
The jogged spindle motor does not need to be in any coordinate system (it must not be in the same
coordinate system as the other axes or it cannot be jogged while a parts program is running), but it is a
good idea to put it in a different coordinate system, because motors that are not in any coordinate system
use Coordinate System 1’s time base control (feedrate override).
Spindle speed values simply are scaled and put into jog speed I-variables (Ix22), and the spindle on/off
functions simply command jog starts and stops (see M03, M04, and M05).
Open-Loop Spindle
If using the open loop spindle, write directly to an otherwise unused DAC output register by use of an M-
variable. For instance, the definition M425->Y:$C00A,8,16,S matches the variable M425 to the
DAC4 output register. Any value given to this M-variable will cause a corresponding voltage on the
DAC4 output line. In this method, a spindle-on command (see M03, M04) could be M425=P10 or
M425=-P10, where P10 has been set previously by an S-code. The spindle-off command (see M05)
could be M425=0.
Switching Between Spindle and Positioning
There are cases where the spindle motor is sometimes used as a regular axis, doing position moves instead
of steady velocity, and sometimes as a regular spindle. In this case, the spindle motor will be made an
axis in the main coordinate system so it can do coordinated moves. When real spindle operation is
desired, a pseudo-open-loop mode can be created by setting the motor's proportional gain to zero and
writing to the output offset register (Ix29). In this method Ix29 would be treated just as M425 was in the
above paragraph. Of course, a velocity-loop (tachometer) amplifier would be required for this mode of
operation. See the example OPENCLOS.PMC for more details.
Constant-Surface-Speed Spindle
To perform in constant surface speed (CSS) mode, write a motion program, because the speed must vary
as a function of another axis position. The suggested method, shown in the example SPINDLE.PMC is to
break the move into small time slices with the commanded distance for each slice dependent on the
system conditions at the time, including commanded speed, mode, and tool radial position.