Dear reader, after reading the last articles you are probably in love with the world of machining. You know the basic differences between milling and turning. You start browsing through the tool catalogues and marvel at the variety of tools. Machine kinematics and cutting parameters absorb you completely. Lovely, but what next? What to do to become a programmer here and now? Feel free to read the article and after that you will be able to write your first complete program. Let’s start!
Programming on the basis of an ISO (International Standard Organization) code is an absolute basis. It is obvious that ISO provides only a certain basic set of commands, so you can see the difference between control systems from different manufacturers but don’t worry – thanks to this basic database you can start programming in virtually any CNC system – FANUC, Sinumerik, Heidenhain or other controls.
Let me start with an example (milling – FANUC):
%
O0001 (YOUR FIRST PROGRAM)
T1 M6
S6000 F3000 M3 M8
G0 G90 G54 G17 X0 Y0
G43 H1 D2 Z200
… psst here is the place for the heart of the program, ie specific blocks related to the work movement
G0 Z200
M30
%
1. O0001 (YOUR FIRST PROGRM)
The first block (not including %) is the program number, in this case program number 1. Then the comment in brackets. Anything in brackets will be ignored by the machine. The situation is different with Heidenhain, everything behind * is a commentary.
2. T1 M6
T is always the tool in this case is number 1. M6 – tool change.
3. S6000 F3000 M3 M8
-
-
- S – speed [rpm]
- F – feed per minute [mm / min] (* Why the feed per minute? More on this later in the article)
- M3 – turning on CW (clockwise) rotation.
-
Being on the subject of rotations, we have two options:
M4 – turn on CCW (counterclockwise) rotation. More common in turning than milling.
M5 – rotation off
M8 – turn on the coolant
M9 – turn off the coolant
4. G0 G90 G54 G17 X0 Y0
The most extensive block in today’s article. First things first:
-
-
- G0 – rapid movement
- G90 – absolute programming (sounds good) and simply explaining it by this code, the machine knows that all subsequent XYZ coordinate values refer to the zero point.
- G91 – Incremental programming, opposed to G90. So the next specified point refers to the previous point (!) and not to the zero point. It is very easy to make a mistake in this arrangement.
- G54 – select base 54. Basic bases start with 54 and end with 57.
- G17 – working plane declaration, in this case X / Y
G18 – Z / X plane – normally used in turning
G19 – Y / Z plane
- X0 Y0 – positioning in the X and Y axes
-
5. G43 H1 D2 Z200
A veeery important block of the program. Never declare a Z earlier than in this block. Only at this point is the length of our selected tool T1 read in from the tool table.
-
-
- H1 D2 – successively the length and radius of the tool entered in the tool table
- Z200 – tool position 200 mm from the zero point
-
6. G0 Z200
The tool moves away with a rapid movement to the Z200 position. It is good to end the program with a safe departure in the Z axis.
7. M30
End of program with rewind to the beginning of the program.
With this neat M30 I finished a short analysis of a sample milling program. It wasn’t that bad, was it? Below I will present you a few more important codes that can be found in programs in other controls and in the construction of a turning program.
TURNING
-
-
- T0101 – we forget about the M6 here. Tool call T1 with offset 1
- G50 S1000 – the maximum value of rotation is set to 1000. I do not advise to plan the face of the shaft without this function, oh, I do not recommend it. PS. In Sinumerik we do not have G50 but we have LIMS = 1000 function.
- G96 – constant cutting speed [m / min], eg G96 S200
- G97 – switching off the constant cutting speed, eg G97 S1500 [rpm]
- G98 – feed in [mm / min] eg G98 F1000 * in Sinumerik G94 (!)
- G99 – feed in [mm / rev] eg G99 F0.25 * in Sinumerik G95 (!)
-
SINUMERIK
-
-
- Program start declared as:
% _N_YOUR FIRST PROGRAM_MPF
- Each block is numbered
N10N20
N30
…
- Practically at the beginning of the program you will find G71 (similar in Heidenhain), that is, all dimensions are given in [mm]. If you want to program in inches, enter G70.
- Program start declared as:
-
HEIDENHAIN
-
-
- Program start declared as:
% YOUR FIRST G71 PROGRAM *
- The next two blocks are dedicated to the definition of the blank
N10 G30 G17 X + 0 Y + 0 Z-20 *N20 G31 X + 100 Y + 80 Z + 0 *
- The end of the program after M30 is:
- Program start declared as:
-
N99999999% YOUR FIRST G71 PROGRAM *
I must admit that the program in Heiden in ISO looks quite unnatural. While still in college, we mainly programmed in plain text and this is the version you will most often encounter:
0 BEGIN PGM YOUR FIRST PROGRAM MM
1 BLK FORM 0.1 Z X + 0 Y + 0 Z-20
2 BLK FORM 0.2 X + 100 Y + 80 Z + 0
…
END PGM YOUR FIRST PROGRAM MM
It’s over for today. I sincerely hope that the material presented in today’s article will be helpful for you.
Natalia Matuszczyk