0% found this document useful (0 votes)
48 views17 pages

CNC Programming Structure

The document describes the main aspects of CNC machine programming, including the structure of a CNC program according to the ISO 6983 standard, the main programming languages such as APT and EIA/ISO, and the linear and circular interpolation systems used.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views17 pages

CNC Programming Structure

The document describes the main aspects of CNC machine programming, including the structure of a CNC program according to the ISO 6983 standard, the main programming languages such as APT and EIA/ISO, and the linear and circular interpolation systems used.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

SENAI School "Roberto Mange" - Campinas CNC

Structures and Characteristics


of the CNC Program
At the end of this unit, you will know the main languages and forms of
programming for CNC machines, as well as the programming structure for
CNC lathes using ISO 6983 standard, and will be able to identify a program
elaborated in the EIA/ISO language.
Structure of a CNC program

IDENTIFICATION

HEADER

TOOL DATA

APPROXIMATION AND MACHINING


OF THE PIECE PROFILE
END OF PROGRAM

Example of CNC program for the GE Fanuc 21 i command - Galaxy10 Lathe


Finishing operation

O0013 (Axis 2532);


N10 G21 G40 G90 G95;
N20 G0 X400 Z300 T00; 5x45°
N30 T0101 (end. Ext. R 0.8);
N40 G54; 5
N50 G96 S220; 1 X400 Z300
4
N60 G92 S3500 M4; 2
N70 G0 X44 Z80;
N80 G1 X-1.5 F.3; 3
N90 G0 X36 Z82;
N100 G42;
N110 G1 Z80 F.1; 2x45°
N120 X40 Z78;
N130 Z60; 40
N140 X54;
N150 Z40; 60
N160 G3 X70 Z32 R8; 80
N170 G1 X80 Z27;
N180 G40;
N190 G1 X85 F.3;
N190 G0 X400 Z300 T00;
N200 M30;
12 Mechatronics
SENAI School "Roberto Mange" - Campinas CNC

There are various methods for creating CNC programs, with the most commonly used being:

Automatic Programming Language APT


At the emergence of CN, in the early 1950s, the first programming language
was the APT (Automatic Programmed Tool). Currently, it is only used as
auxiliary tool in programming parts with very complex geometries,
mainly for 4 and 5 axis machines.
APT is a high-level language.

EIA/ISO Language
Programming language, also known as G-code. It is currently the most
used universally, both in manual programming and in graphical programming,
where CAM is used.
The EIA/ISO codes were created even before the emergence of CNC machines.
they were used in offices in automatic typewriters that used
punched cards.
The EIA/ISO language is considered low-level.

Interactive language
Parametrized block programming has ready-made blocks and does not use code.
Ex. MAZATROL language applied to MAZAK machines.

Graphic production via 'CAM' (Computer Aided Manufacturing)


It is no longer a programming language but rather a way of programming in which the
The programmer must possess knowledge of: machining processes; materials;
tools and devices for machining; computing for file manipulation;
machines (advances, rotations, and parameters); mastery of CAD software and one of
CAM.
Describing in a simplified way, just for easy understanding, the
the programmer enters the drawing of the part, which can be done in the CAM itself or in
drawings received from CAD (Computer Aided Design), defines raw material (type and
dimensions), tools and other cutting parameters, chooses the post-processor of
agreement with the machine that will perform the machining and the CAM software will be responsible for

generate the program, using the codes of the EIA/ISO language.


We will see here how the structure of a program using the EIA/ISO language looks.

Mechatronics 13
SENAI School "Roberto Mange" - Campinas CNC

The CNC program consists of:

Characters: It is a number, letter, or symbol with some meaning for the


Command.(Example:2, G, X, /, A, T).
Addresses: It is a letter that defines an instruction for the command.
(Example:G, X, Z, F).
Words: It is an address followed by a numerical value.
(Example: G01 X25 F0.3).
Data Block: It is a series of words placed in a line, ended by
character; (Example: G01 X54 Y30 F.12;)
Program: It is a series of data blocks (Completed by M30).

Special characters
(;) - End of block : (EOB - End Of Block).
Every block must display a character that indicates the end of the block.
( ) - Comment: The parentheses allow for the insertion of comments. The
characters that come inside parentheses are considered comments and will be
ignored by the command.

Positioning functions
The command works in millimeters for positioning words with a decimal point.
Function X - Application: Position on the transverse axis (absolute)
X20; or X-5;
Function Z - Application: Position along the longitudinal axis (absolute)

Z20; or Z-20;
Function U - Application: Position on the transverse axis (incremental)
U5 ; or U-5 ; (Used in programming done in absolute coordinates)
Function W - Application: Position on the longitudinal axis (incremental)

W5; or W-5; (Used in programming done in absolute coordinates)

Special functions
Function O (used in the GE Fanuc 21i command)
Every program or sub-program in the command memory is identified by the letter
The composition consists of up to 4 digits, ranging from 0001 to 9999.
To facilitate the identification of the program, it is recommended to insert a comment.
observing the use of parentheses.

14 Mechatronics
SENAI School "Roberto Mange" - Campinas CNC

O5750 (Rear axle flange);


Function N
Define the sequence number. Each information sequence can be identified by
a number of one to four digits, which will come after the function N. This function is used in
specified deviations in cycles, and in search of blocks.
Example:
N50G01 X10 ;
N60G01 Z10;
It is not necessary to program the sequence number in all data blocks.
The sequence will appear automatically after the insertion of each data block, unless
to be edited outside the sequence of the program or after its editing
completed.

Function F
Typically in CNC lathes, the feed is used in mm/revolution, but this can also
to be used in mm/min.
The advancement is an important cutting datum and is obtained by taking into account the material,

tool and the operation to be executed.


F0.3 ; or F.3 ;

Function T
The function T is used to select the tools by informing the machine of its
zeroing (PRE-SET), insert radius, cutting direction and corrections.
Program the code T accompanied by a maximum of four digits. The first two
digits define the location of the tool in the tower and its zeroing (PRE-SET), and the
the last two digits define the number of the adjustment broker of measures and corrections of
wear of the insert.
Example: T0202 ;
Up to 12 tools and 32 brokers can be programmed.
The tower rotation and the movement of the cars cannot be in the same block as the
function T, it should be programmed in a single line in isolation.

Important:
The insert radius (R) and the tool geometry (T) must be inserted only in
geometry tools page.

Mechatronics 15
SENAI School 'Roberto Mange' - Campinas CNC

Necessary sequence for


handwritten programming
At the end of this unit, you will know the necessary sequence for a
handwritten programming used in the programming of CNC machines.

The events to be analyzed are the following:

Study of the drawing of the piece, finished and rough

The programmer must have the skill to compare the design (finished piece) with the
desired dimension in machining with computer numerical control machine.
There is a need for an analysis of the feasibility of executing the piece, taking into account
it accounts for the required dimensions, the existing sobermetal from the previous phase, the tooling

necessary, the fixing of the piece, zero piece, etc.

-Process to be used
It is necessary to have a definition of the machining phases for each part to be
executed, thus establishing the system of proper fixation for machining.

Tooling aimed at CNC


The choice of tools is extremely important, as well as their position on the tower.
It is necessary for the tooling to be placed in such a way that there is no interference.
between itself and the rest of the machine. A good program depends heavily on the choice of
appropriate tooling and the fastening of it, conveniently.

Knowledge of the physical parameters of the machine and programming system of


command
Such knowledge is necessary on the part of the programmer, so that they can
frame the operations to utilize all the resources of the machine and the command,
always aiming to minimize the times and phases of operations, while still ensuring the
product quality.

16 Mechatronics
SENAI School "Roberto Mange" - Campinas CNC

Interpolation systems
At the end of this unit, you will know the interpolation systems used in
CNC machine programming.

Linear interpolation
The programmed trajectory in a sentence is followed with a linear orientation, of
any angle, with any forward speed (between 1 to 5000 mm/min).
Knowing point "A", one can reach any point "B" with an advancement.
established, always in rectilinear movement.
Any conical profile can be machined, that is, a conical machining can be established.
from any angle.

Circular Interpolation
The trajectory of the tool is followed with a circular orientation, with any radius,
in both clockwise and counterclockwise directions, at any speed between 1 to 5000 mm/min.
Some information is necessary for arc programming, such as:
final point of the bow,
sense of the arc
center of the arc (pole)

Mechatronics 17
SENAI School "Roberto Mange" - Campinas CNC

Any type of circle can be programmed, forming perfect quadrants or not:

Sense Sense
Schedule Counterclockwise

Meaning Sense
Counterclockwise Schedule

18 Mechatronics
SENAI School "Roberto Mange" - Campinas CNC

List of functions
preparations for displacement
At the end of this unit, you will know the main preparatory functions of
programming for CNC machines.

Preparatory Functions ( G )
The preparatory functions indicate to the command the way of working, that is, they indicate to the

machine what to do, preparing it to perform a type of operation, or to receive


a certain information. These functions are denoted by the letter G, followed by a
number formed by two digits (from 00 to 99 in the case of the GE Fanuc 21i command).
The functions can be:

MODALS - They are the functions that once programmed remain in memory of
command, applicable to all subsequent blocks, unless modified or
canceled by another function of the same family.

NON-MODAL - They are the functions that every time they are required, must be
scheduled, that is, they are only valid within the block that contains them.

List of preparatory functions G for GE Fanuc 21i Command


G00 - Rapid advance
G01 - Linear interpolation
G02 - Clockwise Circular Interpolation
G03 - Counterclockwise circular interpolation
G04 - Duration of stay
G20 - Reference unit of measurement (inch)
G21 - Unit of measurement reference (metric)
G28 - Return axes to machine reference
G33 - Threading cycle
G40 - Cancels tool radius compensation
G41 - Activates tool radius compensation (left)
G42 - Activates tool radius compensation (right)
G63 - Tool zeroing using the Position Reader (TOOL EYE)
G70 - Finishing cycle
G71 - Automatic longitudinal rough turning cycle

Mechatronics 19
SENAI School "Roberto Mange" - Campinas CNC

G72 - Automatic cross roughing cycle


G73 - Automatic roughing cycle parallel to the final profile
G74 - Drilling / Turning Cycle
G75 - Channel cycle / facing
G76 - Automatic Tapping Cycle
G77 - Parallel / Conical Turning Cycle
G78 - Semi-automatic threading cycle
G79 - Parallel / Conical Facing Cycle
G90 - Absolute coordinate system
G91 - Incremental coordinate system
G92 - Establishes rotation limit (RPM)
G94 - Sets feed rate in inches/minute
G95 - Establishes feed x / rotation
G96 - Establishes programming at constant cutting speed
G97 - Establishes programming in RPM

Optional functions - GE Fanuc 21 i


C Angular positioning of the shaft axis
G10 - Tool Life Manager
G22 - Security Area
G37 - Automatic Tool Compensation System
G54 to G59 - Work coordinate reference
G65 - Macro B
G80 - Cancel drilling cycles
G83 - Drilling cycle
G85 - Boring cycle

20 Mechatronics
SENAI School "Roberto Mange" - Campinas CNC

List of miscellaneous functions


List of miscellaneous or auxiliary functions
M00 - Program stop
M01 - Optional program stop
M02 - Program Finale
M03 - Rotate shaft axis clockwise
M04 - Rotate axis shaft counterclockwise
M05 - Shaft tree stop
M08 - Cooling circuit
M09 - Turn off refrigeration
M30 - Program end and return

Miscellaneous or auxiliary functions - GE Fanuc 21 i


M18 - Cancel positioning mode axis tree
M19 - Axis tree in positioning mode
M20 - Activates bar feeder
M21 - For busbar feeder
M24 - Locked plate
M25 - Unlocked plate
M26 - Retract the manga from the movable head
M27 - Advances the sleeve of the mobile head

M36 - Automatic door opening operator


M37 - Automatic operator date port
M38 - Advance piece trimmer
M39 - Retractable display stand for parts

M40 - Selects internal operation mode of the board


M41 - Select external operation mode of the board
M42 - Plate cleaning league
M43 - Turns off board cleaning
M45 - League system cleaning chips protections
M46 - Turns off the chip cleaning system protections
M49 - Bar exchange
M50 - Tool position reader (Tool Eye)
M51 - Advances the tool position reader (Tool Eye)
M76 - Piece counter

Mechatronics 21
SENAI School "Roberto Mange" - Campinas CNC

M86 - Turn on the chip conveyor


M87 - Turns off the chip conveyor
M98 - Call of a sub-program
M99 - Return from a sub-program
NOTE: For commands from different manufacturers, the same function may have
different meanings, but most of the functions, their meaning is common to almost
all commands.

22 Mechatronics
SENAI School "Roberto Mange" - Campinas CNC

Interpolation Functions
linear and circular
At the end of this unit, you will know the functions of linear and circular interpolation.
used in the CNC lathe with their respective syntaxes.

Function G00- Quick positioning (approach and retreat)


The axes move towards the programmed target with the highest feed rate.
available on the machine.
On the GALAXY line, this speed is 18 m/min on the X-axis and 24 m/min on the Z-axis, and it is

initially processed at 45º until one of the programmed goals 'X' or 'Z', to then
to move along a single axis to the desired endpoint.

Syntax:
G0 X___ Z___ ;
where:
X = coordinate to be reached (values in diameter)
Z = coordinate to be reached (length)
The G0 function is a modal command. This function cancels and is canceled by the functions

G01, G02 and G03.

Function G01- Linear interpolation (rectilinear machining or work feed)


With this function, linear movements between two programmed points are obtained.
any angle, calculated through coordinates and with a pre-advance (F)
determined by the programmer.
This function is a modal command, which is canceled and cancels by the functions G00, G02 and

G03.
Syntax:
G1 X___ Z___ F___ ;
where:
coordinate to be reached (values in diameter)
Z = coordinate to be reached (length)
F = work advance (mm/rotation)

Mechatronics 23
SENAI School "Roberto Mange" - Campinas

Example of application of G00 and G01 in external machining.

O0001 (Exercise 01);


N10 G21 G40 G90 G95;
N20 G0 X200 Z200 T00;
10 X200 Z200
N30 T0101 (finishing);
N40 G54; 5
N50 G96 S220;
N60 G92 S3500 M4;
N70 G0 X0 Z85;
N80 G1 Z80 F.5;
N90 X34 F.2;
N100 X50 Z72;
N110 X55;
N120 G0 X200 Z200 T00; ch 8 x 45º
N130 M30; 80 5

Example of application of G00 and G01 in internal machining.

O0002 (Exercise 02); X300Z300


N10 G21 G40 G90 G95;
N20 G0 X300 Z300 T00;
80
N30 T0303 (finish);
N40 G54;
N50 G96 S200;
N60 G92 S3500 M4;
N70 G0 X100 Z85;
N80 G1 Z80 F.5;
N90 X90 Z65 F.2;
N100 Z-3;
N110 G0 X85;
N120 Z85; 15
N130 G0 X200 Z200 T00;
N130 M30;

24 Mechatronics
SENAI School "Roberto Mange" - Campinas CNC

Function G02 - Circular interpolation (radius) - Clockwise direction

This function performs machining operation of pre-defined arcs through a


appropriate and simultaneous movement of the axes.
This G02 function is a non-modal command, which cancels and is canceled by the functions
G00, G01 and G03.
Syntax:
G2 X___ Z___ R___ F___ ;
you
G2 X___ Z___ I___ K___ F___;
where:
X = final position of the arc
Z = final position of the arc
R = value of the radius

I = center coordinate of the arc


K = coordinate of the center of the arc

F = work advance (optional)

Function G03 - Circular interpolation (radius) - COUNTER-CLOCKWISE direction

This function performs machining operations on predefined arches through a


appropriate and simultaneous movement of the axes.
This G03 function is a non-modal command, which is canceled and can be canceled by the functions

G00, G01 and G02.


Syntax:
G3 X___ Z___ R___ F___;
you
G3 X___ Z___ I___ K___ F___
where:
X = final position of the arc
Z = final position of the arc
R = value of the radius

I = coordinate of the center of the arc

K = coordinate of the arc center


F = work advance (optional)

Mechatronics 25
SENAI School "Roberto Mange" - Campinas CNC

Observations:

In the programming of an arch, the following rules must be observed:


The starting point of the arc is the beginning of the tool.
The sense of circular interpolation G02 or G03 (clockwise or counterclockwise) is programmed.
Along with the meaning of the interpolation, the coordinates of the endpoint are programmed.
of the arch with X and Z.
Along with the sense of the arc and the final coordinates, the function R is programmed.
(value of the radius), or else, the functions I and K (coordinates of the center of the arc).

FunctionR- Arc defined by radius


It is possible to program "circular interpolation" up to 180º with the help of function R,
discriminating the value of the radius always with a positive sign.

Function I and K - Arc defined by polar center


The functions I and K define the position of the center of the arc, where:
I is parallel to the X-axis.
K is parallel to the Z axis.

NOTES:
The functions I and K are programmed using the distance from the point of
start of the tool at the center of the arch, giving the corresponding signal to the movement.
The function 'I' must be programmed in radius.
If it is not possible to make the arch, the command will report an error.

Example of application of G02 and G03.

3x45°

4
3 1
X300 Z300

32
60

26 Mechatronics
SENAI School "Roberto Mange" - Campinas CNC

Example of application of G02 and G03 with the R function:


Machining direction adopted 1; 2; 3; 4
O0003 (Exercise 03)
N10 G21 G40 G90 G95;
N20 G0 X300 Z300 T00;
N30 T0101 (finish);
N40 G54;
N50 G96 S220;
N60 G92 S3500 M4;
N70 G0 X0 Z65;
N80 G1 Z60 F.5;
N90 X34 F.2;
N100 G3 X54 Z50 R10;
N110 G1 Z40;
N120 G2 X70 Z32 R8;
N130 G1 X74;
N140 X80 Z29;
N150 X85;
N160 G0 X300 Z300 T00;
N130 M30

Example of application of G02 and G03 with the function I and K:


Machining direction adopted 1; 2; 3; 4
O0003 (Exercise 03);
N10 G21 G40 G90 G95;
N20 G0 X300 Z300 T00;
N30 T0101 (finishing);
N40 G54;
N50 G96 S220;
N60 G92 S3500 M4;
N70 G0 X0 Z65;
N80 G1 Z60 F.5;
N90 X34 F.2;
N100 G3 X54 Z50 I0 K-10;
N110 G1 Z40;
N120 G2 X70 Z32 I8 K0;
N130 G1 X74;
N140 X80 Z29;
N150 X85;
N160 G0 X300 Z300 T00;
N130 M30;

Mechatronics 27
SENAI School "Roberto Mange" - Campinas CNC

Function G04
Application: Length of stay.
Between one movement and another of the tool, a specific one can be programmed.
duration of the same. The G4 function performs a stay, whose duration
is defined by a value 'P', 'U' or 'X' associated, which defines the time spent in
seconds.

The G04 function requires:

G04 X_ _ _ ; (seconds)
you
G04 U_ _ _ ; (seconds)
you
G04 P___ ; (milliseconds)

Example of programming:

O0004 (External channel operation);


N10 G21 G40 G90 G95;
N20 G0 X300 Z300 T00;
N30 T1010 (channel L=3 mm);
N40 G54;
N50 G96 S100;
N60 G92 S2000 M4;
N70 G0 X50 Z90;
N80 G1 X22 Z62 F1;
N90 X16 F0.08;
N100 G4 X1;
N110 G1 X22 F0.5;
N120 G0 X300 Z300 T00;
N130 M30;

28 Mechatronics

You might also like