You are on page 1of 7

CNC PROGRAMING

A program is the transposition of the machining process in to language understood by the


machine .This language is alphanumeric. Programs are arranged into sets of command lines
(shortened to commands), or command blocks. Whatever you call them, a command is a
complete instruction containing words and/or coordinates for one action. (If the action includes
axis movement, it’s sometimes called a motion statement. The command might be as short as
G00 X1.0, which has one word and one coordinate, causing a rapid positioning to X1.0. Or the
command may contain several words, numbers, and coordinates longer than one entire screen
line.).

WORDS
A word is the composition of several characters. example X-50 is a word of 4 characters.
A word is formed by the lettering address, the sign and the module.

 THE LETTERING ADDRESS


A lettering address may define an axis or a function

 AXIS

 A FUNCTION
A true CNC machining center will allow you to control just about all of its functions in a
program. There should be very little or no operator intervention during a CNC machining
cycle.
A program function is any letter of the program beyond those which define dimensions .
they are necessary for good operation of the numerical control machine. The principal
functions are those starting by the following address: G,F,S,T,M and N
According to their mode of action ,we distinguish three types of functions
The preparatory functions.
The miscellaneous functions.
The particular functions.
PREPARRTORY FUNCTIONS
They may sometime be refer as G-codes or cycle codes . they prepare the machine for what
is coming up in the current command and possibly in the up coming command . in many
cases, they set mode meaning once a G-code is instated , it will remain in effect untill the
mode changes is change or cancel
Modal
There are two kinds of G-codes based on their validity:

- Non-Modal G-code: valid only when the G-code is specified,


invalid when not specified.

- Modal G-code: saved in the CNC system when it is executed once,


and valid until other codes of the same group is executed
Below is the list of some few mostly used G-codes
AUXILIARY FUNCTION OR MISCELLANEOUS FUNCTION (M)

Auxiliary function commands consist of the address character "M" and digital numbers. It is
used to control the motion of the programs, various auxiliary switch of the machine, the start
and stop of the spindle, end of the program, etc.
Generally, one program block has only one valid M command. In this system, up to four M
commands can be specified in one block (M commands in the same group cannot be
specified in the same line).
The M commands (M00, M01, M02, M30, and M99) must be in a separate line. In other
words, the program line which contains any of the M commands mentioned above can
contain only one M command, and cannot have other commands such as G commands or T
commands. The relationship between the M commands and their functions depends on the
specific settings of the machine manufacturer.
Modal
The M functions include non-modal and modal functions:
- Non-modal M function (valid only in the current block)
- Modal M function (continuously valid)
Modal Group
Modal M commands are grouped according to different functions. Once the defined modal M
command has been executed, it remains valid until it is canceled by other modal M
commands in the same group.
The Modal M function group contains a default function which is the initial function when
the system is powered on.
Pre- and Post- M functions
The M function can also be divided into pre-M function and post-M function:
- Pre-M function
Executed before the axis motion specified by the program block.
- Post-M function
Executed after the axis motion specified by the program block.
The  table  below  lists  the  most  common  M  codes  and  their  meaning.
PATUCULAR FUNCTION
S COMMANDS
The S command is used to control the spindle rotation speed. The
number that follows S indicates the spindle speed in revolution per
minute (r/min).
The S command is a modal command, and the S function is valid only
when the spindle speed is adjustable.
T COMMANDS
T commands are used for tool selection. The value that follows T
indicates the selected tool number. The relationship between T
commands and the tool is defined by the machine manufacturer.
Milling System
machining center to input a code signal or a strobe signal into the
machine, thereby controlling the rotation of the tool magazine to the
selected tool, and then wait until the completion of the tool change with
the M06 command. For armless type ATC, the M06 and T commands
must be written in the same block. During tool change, the tool number
(e.g. 15) of Group 0 must be the position of the tool clamped on the
spindle in the tool magazine. When you change the tool to another, you
need to firstly return the tool to the corresponding tool position in the
tool magazine (that is No. 15). Then there should be no tool in the
position of No.15, otherwise a collision may occur. The tools in the tool
magazine are automatically managed by the system, and cannot be
modified. After the machine starts, tool position(e.g. No. 15) facing to
the spindle must be the same as tool number of Group 0 in the tool
magazine, and there should be no tool in the corresponding tool position
(e.g. No. 15).
Therefore, when installing tools to the tool magazine, it is recommended
to firstly install the tool on the spindle, then in the MDI mode, run the M
and T commands (e.g. M06 T01) to install the tool through the spindle.
F COMMAND
the F-word specifies the desired feed rate in inches per minute (IPM) in a cutting command
(G01, G02, and G03). The F-word allows a decimal point, so a feed rate of 3-1/2 inches per
minute is programmed as “F3.5". Feed rate is measured as one move per minute.
 THE SIGN

It gives the direction of the tool displacement

 THE MODULE

It is the numerical character. Example: (M3 3 is the module) ; (S53 53 is the module); (T40 40 is the
module)

You might also like