SME-AMP
Chapter 5: NC PROGRAMMING OVERVIEW
5.1 Manual programming & Automatic programming
1. Manual programming :
– NC programs are written directly to a specific CNC control
system,
– Programming time depends on the geometric complexity of
the part and the capability of the control system,
– The possibility of making mistakes is easy and difficult to
recognize.
– Nowadays, it is common to use simulation software to check
the program.
Machine-tool and Tribology 1
Chapter 5: NC PROGRAMMING OVERVIEW
5.1 Manual programming & Automatic programming
2. Programming by machine (Computer and specialized software)
– Using a synchronous software system from designing to
creating NC programs, with software that simulates the
machining process.
– Support the calculation of coordinates, calculation of
technological parameters
– There is a library of parameters of cutting tools, clamping
devices...
– Supports optimization of the machining process.
– Has a library of CNC machine tools, and compatible control
systems
Machine-tool and Tribology 2
5.1 Manual programming & Automatic programming
• Automatic programming procedures:
– Set geometry of parts and workpieces (CAD)
– Determine the machining steps, the software to support
the selection of tools and the corresponding technological
parameters, depending on the material selected for
processing.
– Simulate the machining process, select the machine tool,
select the control system, then output the NC file, send it
to the CNC machine.(CAM)
Machine-tool and Tribology 3
MTT 9_1
SME-AMP
5.2 Principles of programming structure for CNC
machines
1. Standardization of NC Programming (ISO)
• The NC program contains information about the path
command system and the switch command system,
• The NC program is made up of a series of instructions, it
is used to control the CNC machine tool,
• Commands are encoded in the form of numbers, letters
and special characters,
• The ISO-6983 standard specifies the general limits of the
instructions as well as the basic structure of an NC
program.
• Control system manufacturers have extended the range
of encoding specific NC instructions for their control
systems on the basis of the general provisions of ISO-
6983. Machine-tool and Tribology 4
5.2 Principles of programming structure for CNC
machines
2. Basic structure of NC program
• Start the program: (Ex: %PHAY018): Purpose to easily
manage, store and access when needed.
– There are special characters specified by the system
manufacturer: %
– Next is the name of the program set by the
programmer, up to 6 characters, including letters and
numbers
Machine-tool and Tribology 5
5.2 Principles of programming structure for CNC
machines
2. Basic structure of NC program
• Program body :
– Includes commands that are arranged in a certain
sequence to machine the most optimal part.
– The statements contain information about the
geometry, technology, and engineering of the
program.
– Usually one command provides enough
information for each machining step.
Machine-tool and Tribology 6
MTT 9_2
SME-AMP
O0005 ( LopCNC- Bai tap 1 ) N80 X0
N5 M6 T1 N85 G40 X-10 Y-10
N10 M3 S1000 N90 Z9
N15 G0 X-40 Y25 Z9 N95 M6 T4
N20 G1 Z0 F100 N100 G0 X25 Y25 Z30
N25 X90 F500 N105 G81 G99 X10.5 Y12 Z-
N30 G0 Z9 15 R3 F200
N35 M1 N110 G98 X39.5
N40 M6 T2 ( phay vien ) N115 G80
N45 M3 S2014 N120 M6 T5
N50 G0 X-10 Y-10 Z9 N125 M3 S2014
N55 G1 Z-12 F100 N130 G0 X25 Y25 Z15
N60 G41 H12 X0 N135 G81 X25 Y5 Z-18 F200
R3 F200
N65 Y50
N140 X5 Y31
N70 X50
N75 Y0 N145 X25 Y45
N150 X45 Y31
N155 M30
5.2 Principles of programming structure for CNC
machines
• End program :
– The program is terminated by the instruction M30 or
M02.
Comments enclosed in parentheses are ignored by the
controller during program execution.
Start the program
Program body
End program
Machine-tool and Tribology 8
5.2 Principles of programming structure for CNC
machines
2. Command structure, command word
• Command structure :
(For example: N0035 G01 X10.01 F100 S2000
M08 LF)
– The first is the instruction number N0035, which is
given only once in a statement. It does not affect the
impact of each command.
– The travel condition of the cutting tool G with 2 digits
(eg: G01) determines the movement trajectory of the
cutting tool.
– Destination coordinates: X_, Y_ , Z_ with numbers are
the coordinates of the target point to which the tool
moves. Machine-tool and Tribology 9
MTT 9_3
SME-AMP
5.2 Principles of programming structure for CNC
machines
– The interpolation parameters: I_, J_, K_ along with the
numbers are the coordinates of the center of the arc
according to the value relative to the starting point.
– The feed amount F_ with numbers (eg F100) it is used
to control the travel speed of the cutting tool, Default is
mm/min, or mm/rev.
– Spindle rotation speed: S_ is used to control the number
of revolutions of the spindle in rpm (eg S2000)
– The auxiliary function M08 is a machine function used
to register technological parameters, entered after the
command words (eg: F, S, T ) in a command line with
no more than 3 machine functions
Machine-tool and Tribology 10
10
5.2 Principles of programming structure for CNC
machines
– T06 cutting tool function is used to specify the cutting tool to
be used, the meaning of this address is not the same in control
systems and usually has two basic tasks:
– Calling the specified tool in the tool holder
– Access the cutting tool calibration size in the machine's
memory
Machine-tool and Tribology 11
11
5.2 Principles of programming structure for CNC
machines
– It should be noted that the numbers depending on the address
letters will mean an instruction code or a value then it can
have a negative value, the form of the number depends on the
regulations of each operating system. different controls,
– Usually there are 3 groups of command words in a command:
Journey conditions, Destination coordinates, Technology and
auxiliary functions.
Machine-tool and Tribology 12
12
MTT 9_4
SME-AMP
5.2 Principles of programming structure for CNC
machines
• The structure of the command word
– The command word is made up of an address letter and
numbers,
– The meaning and sequence of command words are
specified in each control system (determined by the
manufacturer).
– Example: N0035 G01 X10.01 F100 S2000 M08 LF
– N0035: Numerical description of the NC instruction for
address N
– G01: Meaning of code 01 for address G, the tool
movement is a straight line with the corresponding feed
– X10.01: The significant number 10.01 is a value for the Z
address in relation to the G01 address, indicating that the
tool needs to move to the X10.01 degree with the given
feed rate and in the coordinate system. immediately
Machine-tool and Tribology 13
13
5.3 Basic code according to ISO- 6983
• Fast feed movement G00
• Line interpolation with specified feed amount movement G01
• clockwise interpolation movement G02
• counter-clockwise interpolation movement G03
• Feed movement stop time (s) G04
• Precision stop G09
• Convert units to mm G20
• Convert units to inches G21
• Call subroutine G22
• Repeat program segment G23
• Canceling tool radius correction G40
• Adjust the radius to the left of the contour G41
Machine-tool and Tribology 14
14
5.3 Basic code according to ISO- 6983
• Adjust the radius to the right of the contour G42
• In and out of the tool parallel to the G45
• profileIn and out of the tool in a semicircle G46
• In and out of the tool in a quarter of a circle G47
• Canceling G53
• Relative zero shift Zero point displacement G54,... G59
• Programmable in absolute size G90
• Programmable to G91
• Relative SizeFeed rate mm/min G94
• Feed amount mm/rev G95
• Drilling (milling) cycle G81
• Grooving Cycle G79
Machine-tool and Tribology 15
15
MTT 9_5
SME-AMP
5.3 Basic code according to ISO- 6983
• Coordinates in X, Y, Z axes X_,Y_, Z_
• Coordinates of the arc center in relative coordinates X, Y,
Z I_, J_, K_
• Spindle number of revolutions (rpm) S_
• Feed amount F_
• Specify the instrument T_
• Tool replacement M06
• Open the right rotating spindle M03
• Open left rotating spindle M04
• Open coolant M07, M08
• Turn off coolant M09
• End of program M30
Machine-tool and Tribology 16
16
Example
Machine-tool and Tribology 17
17
Example
Machine-tool and Tribology 18
18
MTT 9_6
SME-AMP
Example
Machine-tool and Tribology 19
19
Example
Machine-tool and Tribology 20
20
Example
Machine-tool and Tribology 21
21
MTT 9_7
SME-AMP
Example
Machine-tool and Tribology 22
22
Example
Machine-tool and Tribology 23
23
Example
Machine-tool and Tribology 24
24
MTT 9_8
SME-AMP
Example
Machine-tool and Tribology 25
25
Machine-tool and Tribology 26
26
Machine-tool and Tribology 27
27
MTT 9_9
SME-AMP
Machine-tool and Tribology 28
28
Machine-tool and Tribology 29
29
Machine-tool and Tribology 30
30
MTT 9_10
SME-AMP
Machine-tool and Tribology 31
31
Machine-tool and Tribology 32
32
Machine-tool and Tribology 33
33
MTT 9_11
SME-AMP
Machine-tool and Tribology 34
34
Machine-tool and Tribology 35
35
Machine-tool and Tribology 36
36
MTT 9_12
SME-AMP
Machine-tool and Tribology 37
37
Machine-tool and Tribology 38
38
Machine-tool and Tribology 39
39
MTT 9_13
SME-AMP
Machine-tool and Tribology 40
40
Machine-tool and Tribology 41
41
Machine-tool and Tribology 42
42
MTT 9_14