On machines with a C Axis: The C Axis can be used to orient the machine spindle to any position required.
On machines without a C Axis, but with a servo and encoder (as is used in rigid tapping), it is almost always possible to re-orient the spindle to the desired angle by altering the parameters for the M19 tool changer position.
The following procedure and G code applies to machines with Fanuc controls. A similar approach will work on most machine tools however the exact coding and parameter numbers will vary depending on the machine and control.
This is the exact Fanuc code with procedure and additional explanation to follow.
N4077 P1 R(xxx);
(See notes below)
- Find and record the value of parameter N4077.
- Add these lines to your part program for each desired angle:
M19 (Orient Spindle)
G10 L50 (Access L50 parameter page)
N4077 P1 R(xxx) (Parameter No., Bit No., New Value(xxx)
G11 (Turn off G-10)
M19 (Reorient spindle to new position)
- Prior to tool change, repeat code to return Parameter N4077 to its original value. Note: "R" value will be in encoder pulses. You may have to experiment to determine "pulses per degree". On machines with Fanuc controls and drives, the spindle encoder typically has 4096 pulses per revolution. This means you would add or subtract 11.3778 pulses per desired degree of spindle rotation (4096 pulses / 360 degrees = 11,3778 pulses per degree). Other machines may have encoders with different counts. You can call your machine tool builder and ask for this information. However some experimentation with different values is usually faster.
Always identify the spindle orient parameter and record the value first.
An explanation of the M19 cycle is helpful to understand how we are using this code to index your spindle.
When your control sees an M19 request it slowly rotates the machine tool spindle "looking" for the marker pulse on the encoder (encoders have one discrete pulse marking "zero". This is called the marker pulse). When it sees the marker pulse, it will count out however many pulses are stored in the orient parameter (N4077 on Fanuc). In that position it will lock up the spindle.
Example: You find parameter N4077 had a value of 500 and you have determined that you have a 4096 count encoder. You have aligned the head using the procedure described in the section on Radial Head Adjustment" so at spindle orient the tool is pointed to zero degrees.
To index the spindle to a 30 degree angle we would change parameter N4077 to 841 (4096/360 = 11.377778 X 30 + 500 = 841.333)
Yes, you will be 1/3 of a pulse off but remember one degree is 11+ pulses. It can be important, however, not to let this error accumulate. Recalculate from the marker pulse each time instead of adding to your current position. If your second hole is an additional 30 degrees, change the parameter to 1183 (4096/360 = 11.377778 X 60 + 500 = 1182.666)
To be clear, these numbers are typical for the Fanuc control. Your formula may be different. Actual numbers are determined as follows:
(your spindle encoder count/360 = pulses per degree of rotation X desired index in degrees + initial parameter count = new parameter value)
- On fanuc 30i change L50 to L52.
- On some machines an M19 command may be "latched" by the software and ignored if the spindle has not been moved since the last M19. Adding an S50M03; G04X1; M05; will unlatch the M19 so you can do another one.
- Newer Mori Seikis have an M119 feature which can be used instead of M19 here is some customer supplied comment on the issue. Download text.
- Very cool subroutine for Fanuc controls if you have the "variable" option. Download text.