written 5.3 years ago by |
CNC (Computer Numerical Control) is the general term used for a system which controls the functions of a machine tool using coded instructions processed by a computer.
1) A part program is written, using G and M codes. This describes the sequence of operations that the machine must perform in order to manufacture the component. This program can be produced off-line, ie, away from the machine, either manually or with the aid of a CAD/ CAM system.
2) The part program is loaded into the machines computer, called the controller. At this stage, the program can still be edited or simulated using the machine controller keypad/input device.
3) The machine controller processes the part program and sends signals to the machine components directing the machine through the required sequence of operations necessary to manufacture the component.
The application of CNC to a manual machine allows its operation to become fully automated. Combining this with the use of a part program enhances the ability of the machine to perform repeat tasks with high degrees of accuracy.
Program Structure:
The organisation of blocks of data within the program follows a layout. Again, it is recommended that the programmer keeps to this program layout.
The main program can be generated using CAD/CAM software package, saved onto disk and transferred to the CNC.
Alternatively, the main program can be manually entered into the CNC memory when the controller is set in Edit Mode.
CNC programs list instructions to be performed in the order they are written. They read like a book, left to right and top-¬‐down. Each sentence in a CNC program is written on a separate line, called a Block. Blocks are arranged in a specific sequence that promotes safety, predictability and readability, so it is important to adhere to a standard program structure.
Typically, blocks are arranged in the following order:
Program Start
Load Tool
Spindle On
Coolant On
Rapid to position above part
Machining operation
Coolant Off
Spindle Off
Move to safe position
End program
Simple CNC Program
Alphabetic & Special Character Address Codes
Every letter of the alphabet is used as a machine address code. In fact, some are used more than once, and their meaning changes based on which G-¬‐code appears in the same block.
Codes are either modal, which means they remain in effect until cancelled or changed, or non-¬‐modal, which means they are effective only in the current block.
The table below lists the most common address codes. .
G Codes
Codes that begin with G are called preparatory words because they prepare the machine for a certain type of motion. The most common G-¬‐codes are shown in Table
M Codes
Codes that begin with M are called miscellaneous words. They control machine auxiliary options like coolant and spindle direction. Only one M-¬‐code can appear in each block of code.
The table below lists the most common M codes and their meaning.
G00 Rapid move
Rapid moves are used to move from point to point in free space, not cutting material. These moves do not require a feed rate input as they take place at max velocity of the machine. In absolute position mode (G90) X, Y and Z define the end point of the move in the user coordinate system. In incremental position mode (G91) X, Y and Z define the distance and direction to move from the current position.
Format: G00 X__ Y__ Z__
G01 Linear Feed Move
Linear feed moves are point to point moves in a straight line at a federate specified by F. The moves are interpolated so all axes in motion reach the end point at the same time. In absolute position mode (G90) X, Y and Z define the end point of the move in the user coordinate system. In incremental position mode (G91) X, Y and Z define the distance and direction to move from the current position.
Format: G01 X__ Y__ Z__ F__.
G02/G03 Arc Feed Move
Used to cut an arc at a federate specified by F. An arc is defined by its start and end points, its radius or center point, a direction, and a plane. Direction is determined by G02, clockwise, and G03, counterclockwise, when viewed from the plane’s positive direction.
To specify the radius, use R and input the actual radius of the desired arc. When an arc is created knowing only start and end points and a radius there are two possible solutions, an arc with a sweep less than 180° and one with sweep greater than 180°. The sign of the radius value, positive or negative, determines which arc will be cut. A positive value for R cuts an arc with sweep less than 180°. A negative value for R cuts an arc with sweep greater than 180°.
Format 1: G90 G02/G03 X__ Y__ R__ F__
Format 2: G91 G02/G03 X__ Y__ R__ F__
A more accurate and reliable way to define an arc is by specifying the center point, this is done with arguments I, J, and K. The center point must be defined in the current plane. I, J, and K correspond to X, Y, Z respectively; the current plane selection will determine which two are used. XY plane (G17) would use I and J for example. Mach has two settings for how I, J, and K should be specified, absolute and incremental. This setting can be changed by G code, G90. and G91. This setting is independent of the G90/G91 setting. If arc center mode is set to incremental then I, J, K are the distance and direction from the start point to the center point of the arc. If arc center mode is set to absolute then I, J, K are the absolute position of the arc center point in the current user coordinate system.
Format 3: G90 G02/G03 X__ Y__ I__ J__ F__
Format 4: G91 G02/G03 X__ Y__ I__ J__ F__
Example:
The above tool path can be programmed as follows (In absolute mode, G90):
Format 1
G01 X100 Y40 F125 ;
G03 X80 Y60 I-20 ;
G01 X60 ;
G02 X40 Y40 I-20 ;
or,
Format 3
G01 X100 Y40 F125 ;
G03 X80 Y60 R20 ;
G01 X60 ;
G02 X40 Y40 R20 ;
The above tool path can be programmed as follows (In incremental mode, G91):
Format 2
G03 X-20 Y20 I-20 ;
G01 X-20 ;
G02 X-20 Y-20 I-20 ;
or,
Format 4
G03 X-20 Y20 R20 ;
G01 X-20 ;
G02 X-20 Y-20 R20 ;
Cutter compensation (G40, G41, G42)
The use of cutter compensation allows the programmer to use the part geometry exactly as from the print for programmed coordinates. Without using compensation, the programmer must always know the cutter size and offset the programmed coordinates for the geometry by the amount of the radius. In this scenario, if a different size cutter is used the part will not be machined correctly. An added advantage for using cutter compensation is the ability to use any size cutter as long as the offset amount is input accurately into the offset register. It is also very effectively used for fine-tuning of dimensional results by minor adjustments to the amount in the offset register.
• G40 = Cutter Compensation Cancel
• G41 = Cutter Compensation Left
• G42 = Cutter Compensation Right
Cutter Radius Compensation Left
The tool is positioned on the left hand side of the part, as seen following the direction of movement, from behind the tool.
Cutter Radius Compensation Right
The tool is positioned on the right hand side of the part, as seen following the direction of movement, from behind the tool.
Tool Length Compensation (G43, G44)
In an CNC Programming Tool length compensation Code is used to adjust for differences in length between different tools, without worrying about those differences in your part program.
This standard length is the Reference Tool. In general, you load the Reference Tool, jog the Z axis down until that tool touches some surface, and set the Z Reference position there. The control memorizes this position of its Z axis. You then load each other tool, bring that tool down until it touches the same surface, and tell the control to measure the tool. The control compares the Z axis position with this tool touching the surface to the previously stored Z Reference position. The difference in Z axis positions is stored as the length offset for the tool.
Clearly, to touch the same surface with a shorter tool, you have to move the Z axis down further. This results in a negative offset. The shorter the tool, the more the negative offset. To touch the same surface with a longer tool, you don't have to move the Z axis down as far. This results in a positive offset. The longer the tool, the larger (or less negative) the offset.
Listed below are the Three G-Code used only for the tool length compensation,
G43 Tool Length Compensation + (plus)
G44 Tool Length Compensation - (Minus)
G49 Cancel Tool length Comp G43 and G44