Wednesday 10 April 2019

CNC (G and M code)



Introduction:
Computer Numerical Control, commonly known as CNC, is the general term used for a system which controls the functions of a machine tool using coded instruction processed by a computer. This means that the computer can convert the design that is produced by a Computer Aided Design application into numbers. These converted numbers are actually coordinates of a graph and they are capable of controlling the movement of CNC tools. In this way, the computer can control the different fabrication process done on the materials.
Once the CNC machine is set up for running, running the machine is not so tough. In fact, the operator has to perform very little less work as the device is automated. The operators are required to do other things with these CNC operations like making normal adjustments, measuring job piece, etc.

A common layout is called 3-axis, which are the three movements familiar as left-right, forward-back and up-down. There may be additional rotary or tilt axes added, to a total of five or even six axes. Spindle or cutter rotation is not considered one of these.
There are major two types of CNC machining systems:
·        Milling and,
·        Turning
Each system is better suited for manufacturing different geometries. CNC milling operation is the popular CNC machine architecture. In CNC milling process, the job piece part is mounted onto the bed and the material is removed using rotational cutting tools.
Benefits of CNC machine:
Following are the major benefits of CNC machine:
·        CNC can handle wood, metal, plastic or something else,
·        The CNC machines are much faster in operation,
·        It is highly precise and less time consuming
Drawbacks of CNC machine:
·        For operating CNC machine, you not only need to learn programming but also depth knowledge of some other techniques and one should have technical background. This makes it a little more complicated.
·        CNC machines can be very dangerous if allowed to operate without supervision.
G-code
G-code is a programming language in which an operator gives information to computerized machine tools. G-code (also RS-274), which has many variants, is the common name for the most widely used numerical control (NC) programming language. It is used mainly in computer aided manufacturing to control automated machine tools. First appeared in 1950s (first edition), it was designed by Massachusetts Institute of Technology (MIT).
Preparatory functions, called as G codes, are used to determine the geometry of tool movements and operating state of the machine controller; functions such as linear cutting movements, drilling operations and specifying the units of measurement. They are normally programmed at the start of a block. A G code is defined using the G address letter and a two digit number as follows:
G XX
Where G is the address and XX is the two digit number.
A Part Program, is a list of coded instructions which describes how the designed component, or part, will be manufactured. These coded instructions are called data- a series of letters and numbers. The part program includes all the geometrical and technological data to perform the required machine functions and movements to manufacture the part.
The Main Program, is the controlling program, i.e. the program first read, or accessed, when the entire part program sequence is run. This controlling program can then call a number of smaller programs into operation. These smaller programs, known as sub programs, are generally used to perform repeat tasks, before returning control back to the main program. Main programs are written using I.S.O address codes, which are listed below:
·        N, refers to the block number,
·        G, refers to the G code,
·        X, refers to the absolute/ incremental distance travelled by the slide tool in the X direction,
·        Y, refers to the absolute/ incremental distance travelled by the slide tool in the Y direction,
·        Z, refers to the absolute/ incremental distance travelled by the slide tool in the Z direction,
·        F, refers to the feed rate,
·        M, refers to the M code (Miscellaneous function),
·        S, refers to the spindle speed,
·        T, refers to the tooling management.
Each block, or program line, contains addresses which appear in the following order and the order should be maintained throughout every block in the program, although individual blocks may not necessarily contain all these addresses.
N, G, X, Y, Z, F, M, S, T.
Tool Movement:
The tool moves along straight lines and arcs forming the job piece shape as desired.
a.      Tool movement along a straight line:
Program command format:
GØ1 Y _ _ _ _ ; (P1 - P2)
 X _ _ _ _ Y _ _ _ _ ; (P2 - P3)
 X _ _ _ _ ; (P3 - P4)

b.     Tool movement along an arc:
Program command format
GØ3 X _ _ _ _ Y _ _ _ _ R _ _ _ _ ; (P1 - P2)
The function of moving the tool along straight lines and arcs is called the Interpolation. Symbols of the programmed commands GØ1, GØ2 and GØ3 are called the Preparatory functions and specify the type of interpolation conducted in the control unit.
NOTE: On an actual machine, the table moves in relation to the cutter. To make the command diagrams easier to understand, this manual assumes the tool moves with respect to the work piece.

Feed Function:
The movement of the tool at a specified speed for cutting is called the Feed rate. The feed rate is defined using the F address letter followed by a numerical value. Using the G2Ø code, the feed rate is defined in Inches per minute. Using the G21 code, the feed rate is defined in milimeters per minute.

M codes (Miscellaneous Functions):
Miscellaneous functions, called M codes, are used by the CNC to command on/off signals to the machine functions. ie, MØ3 - spindle forward (CW), MØ5 - spindle stop, etc..... The functions allocated to lower M code numbers are constant in most CNC controls, although the higher M code number functions can vary from one make of controller to the next. An M code is defined using the M address letter and a two digit number as follows:
M XX
Where M is the address and XX is the two digit number.

Spindle speed function (Cutting speed):
The rotational speed of the tool, with respect to the workpiece being cut, is called the spindle (or cutting) speed. The spindle speed is defined using the S address letter, followed by a numerical value, signifying the spindle RPM (revolutions per minute). The spindle speed value specified must fall between the machine tool RPM range for the command to be effective.
Notes:
·        When a move command and an S code are specified in the same block, a simultaneous execution of the commands is performed,
·        Only one S code is allowed in each program block.



Tool Function:
Tool profiles can be changed during a program using the tool function command. Each tool profile is assigned a number, which in the case of an ATC (Automatic Tool Changer) will also coincide with one of the free bays on its carousel magazine. The tool number is defined using the address letter T, followed by a number assigned to the tool profile. To command a tool change, the MØ6 code would precede the number of the "new" tool required. For example, MØ6 TØ1 This command is read perform a tool change to tool number Ø1.
Notes:
·       The MØ6 code (automatic tool change) must immediately precede the T code within the program block,
·       Only one T code is allowed in each program block,
·       If the machine control reads an MØ6 T _ _ command when running in Automatic Mode, the three axes will drive to the tool change position and the spindle will stop. At this point, the tool change will be performed, if an ATC is fitted. This will always happen, irrespective of the tool position when the tool change command is read from the program.

No comments:

Post a Comment