CNC Machine Programming Guide
CNC Machine Programming Guide
SUPERIOR OF MISANTLA
Engineering. Electromechanics
INTEGRATED SYSTEMS OF
MANUFACTURE
Machine Programming
Program Planning
Choice of the Right Machine. The choice of an appropriate machine for a specific piece to
being manufactured is usually the responsibility of the production manager, the manager of the
machine shop, and / or the CNC manager. The manager must know:
Operations sheet. The operations sheet, or installation sheet, is used to describe the
necessary processes to machine a part on a CNC machine. Each process is written in the
appropriate sequence of machining and includes the tool to be used and all cutting data.
Operations Sheet
Operations Sheet
Machine: Electro -LI2 Workpiece: plate-1 Juanito
Pérez 1/7/2004
3.0
• I.P.M. / R.P.M.
Example: Find the FPR value (in inches) of a cutter that advances at 200 RPM and with a value
IPM = 22.
• I.P.M. / T x R.P.M.
Example: Find the FPT value (feed per tooth, in inches) for a 4-flute end mill.
and of 2" that advances at 200 RPM and with an IPM value = 20. FPT = 20 / 4 x 200 FPT = .025
2.3. STRUCTURE OF A CNC PROGRAM
Sequence numbers or block numbers with the letter N are generally used.
In editing the program, they can be numbered in batches of 10, in batches of 5, in batches of 2, in case it is
it is necessary to insert programming blocks between this. In CNC lathe programming,
necessary when programming the turning cycles. The counting of the number of blocks goes up to
N 9999 and will continue with N0000 a new count if necessary. A symbol / is used when
needs certain programming blocks to have the possibility to execute or not
According to the needs. If the Block delete or block skip button is activated on the control panel, the
control does not execute programming blocks that start with the symbol / in this case no
I would execute block N10.
After the block number, the instruction codes G, M, F, S, T, X, Z are programmed, with which
You can activate several functions but only perform one movement for each block of
programming closed by the symbol * or by (;).
The structure of the program ends with the code M30 (end of program).
/ N10 G28 U0 W0 *
N20 G54 *
“ “ “
“ “ “
“ “ “
N250 M30 *
It is important to highlight that the description of some G and M codes may vary from one manufacturer to another.
from controls to another depending on the standard they work with, whether it's ISO or DIN standard, etc.
Above all, some M codes are assigned differently by each machine manufacturer.
CNC according to the options included in the machine.
The numerical control program must be introduced to the control system in such a way that it understands it.
The program consists of a sequence of blocks. Each block can contain several of the
following characters, accompanied by a code or value.
N: Block number.
G: Preparatory functions.
Axis quotas.
Tool number.
Auxiliary function.
The construction of a block must be done following the order outlined, containing only
the new information.
At the end of the block, it is possible to write a comment that must be in parentheses. The number
maximum number of characters, including parentheses, is 43. The comment appears during execution
of the program and intermittently if the first character within the parentheses is an asterisk (*
An empty comment ( ), cancels the display of a previous one.
For the programming of the controls, ISO has standardized the programming language for
CNC machinery, apart from this, the manufacturers of each control design their own language for their
controls that are called conversational language, interactive in graphic form; but a
A programmer who masters the ISO language can manage well with any control, that is because
that we will focus on this programming format.
Like any language, programming language is also made up of words, every word
it means an order that the programmer gives to the control, the programming codes that are handled
they are the following:
G codes: initially created to describe the geometry of the workpiece, if the piece has
straight lines, arcs, etc.
Miscellaneous Codes
M13: Turn the spindle clockwise and open the cooling passage
M14: Rotate the spindle counterclockwise and open the coolant flow
M30: End program and set the execution pointer to its start
M48: Disable Spindle and Feed override (machine exclusively with the speeds)
programmed)
In movements where machining is required without the spindle rotating, the feed is programmed.
machining F in millimeters per minute (in the case of lathes or milling machines with tool
If F80 is programmed, the machine will move at 80 millimeters per minute (mm/min).
Code T: Tool = Work tool, the programming of the tool number is done from
agreement with the operational order of the specific machining of a part, that is, if we are going to thread
a piece, the first tool T0101 will be the center drill, the second tool T0202 will be
the drill, the third tool T0303 the threading tap, and so on.
The first two digits of the T code refer to the tool position number in the
turrent, and the next two to the tool offset corrector. T0000 is programmed.
At the beginning of the program to cancel all the tool compensation that have remained
activated.
Codes X, Z, U, W: These codes are used to designate work coordinates on the lathe.
In a lathe, the X axis (U incremental coordinate X) is the displacement of the cross carriage.
determining the diameters of the workpiece, the Z axis (W incremental coordinate Z) is the
longitudinal displacement of the car, determining the lengths of the piece. In addition to these
codes we can find the C codes, (H incremental coordinate C)) to designate the third
axis, which is generally a rotating axis, used in milling lathes with tool
motorized (also called a living tool). The C axis is the cup that serves as a rotating axis.
indexing in degrees or interpolating with the axes
2.7 SUBROUTINE CODES
Functions G20, G21, G22, G23, G24 (Subroutines)
STANDARD.
PARAMETRICS.
STANDARD SUBROUTINE
A standard subroutine always starts with a block that contains the function G22 (Open
subprogram). N010 G22 N1 ; N1 is the subprogram number.
N050 G24
N090 G20 N1.3; In this block the .3 means the number of times we want it to repeat the
subroutine N1.
PARAMETRIC SUBROUTINE
A parametric subroutine always starts with a block that contains the G23 function followed by the
number that identifies the subroutine.
N010 G23 N1
The call to a parametric subroutine is made with the G21 function followed by some parameters.
that I will explain next. The block format must follow this pattern:
N030 G21 N1.3 P1=K1; P1=K1 are the values assigned to the parameters.
Example of standard subroutine N010 G0 G90 X20 Y20 Z100 S1000 M03
N030 M06
N050 G0 Z3
N070 G4 K1.0
N080 G0 Z100
N130 M30
This program makes two drills. The first is done at position X20 Y20 and the second drill
at position X40 Y75.
N020 G54
N030 T8.8
N040 M06
N070 G23 N3
N090 X P2 Y P3
N100 X P4 Y P5
N110 X P6
N120 G24
N130 G21 N3.1 P0=K15 P1=K30 P2=K15 P3=K-30 P4=K-30 P5=K0 P6=K0
N150 Z10
N170 G21 N3.1 P0=K0 P1=K30 P2=K30 P3=K0 P4=K0 P5=K-30 P6=K-30
N190 M30
This program machines a triangle and a square. To do this, it will be enough to modify the parameters.
to create either a triangle or a square. We always use the same
program, that is, the subroutine N3, along with the different parameters.
It is a simple example in parametrics. In any case, it will be explored further later on.
parametric programming.
a) Canned drilling cycle. It is used for the manufacture of holes in the triac.
Where: