CNC Programming Structure
CNC Programming Structure
IDENTIFICATION
HEADER
TOOL DATA
There are various methods for creating CNC programs, with the most commonly used being:
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.
Mechatronics 13
SENAI School "Roberto Mange" - Campinas CNC
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)
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
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,
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
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
-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.
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
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
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.
Mechatronics 19
SENAI School "Roberto Mange" - Campinas CNC
20 Mechatronics
SENAI School "Roberto Mange" - Campinas CNC
Mechatronics 21
SENAI School "Roberto Mange" - Campinas CNC
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.
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
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
24 Mechatronics
SENAI School "Roberto Mange" - Campinas CNC
Mechatronics 25
SENAI School "Roberto Mange" - Campinas CNC
Observations:
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.
3x45°
4
3 1
X300 Z300
32
60
26 Mechatronics
SENAI School "Roberto Mange" - Campinas CNC
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.
G04 X_ _ _ ; (seconds)
you
G04 U_ _ _ ; (seconds)
you
G04 P___ ; (milliseconds)
Example of programming:
28 Mechatronics