This is the basic of CNC Programming .Here you will get a complete idea about the programming for CNC machine.Here you will learn about the codes,defining part of the program,Operation part of the program and closing part of the program.You will learn about some simple example of programming.

Facing programTurning programTaper turning program
Grooving ProgramRadius programTurning cycle & Facing cycle

Basic of CNC programming is to learn about G codes ,M codes and all the steps.It is to learn about all steps of a program to complete a machining process.

Basic of cnc programming codes

Language of CNC machines

What is G code..?

CNC machine language which control the movement of axis /Tools.

What is m code..?

CNC machine language which control the machine function.

Here we are going to learn about Basic programming of FANUC (Oi-TB)and SIEMENS(802d/802dSL/828d).

Siemens G code list-802d

CodesFunction
G00Linear interpolation at rapid traverse rate
G01Linear interpolation at feed rate
G02Circular interpolation clockwise
G03Circular interpolation counter clockwise
G04Dwell time
G18Z,X-Plane(Standard turning)
G33Thread cutting with constant lead
G40Tool radius compensation off
G41Tool radius compensation left of contour
G42Tool radius compensation right of contour
G53Settable work- offset–Non- modal skipping
G541st settable work offset
G552nd settable work offset
G563rd settable work offset
G574th settable work offset
G585th settable work offset
G596th settable work offset
G71Metric dimension data input
G90Absolute dimension data input
G91Incremental dimension data input
G95Feed rate F in mm/Spindle revolutions

Siemens M code list-802d

CodesFunctions
M00Programmed stop
M01Optional stop
M02End of the program with return to program start
M03Clockwise rotation of spindle
M04Counter clockwise rotation of spindle
M05Spindle stop
M08Coolant ON
M09Coolant OFF
M30End of program(as M02)

Fanuc G codes-Series Oi-TB

CodesFunction
G00Rapid traverse
G01Linear interpolation
G02Circular interpolation-CW
G03Circular interpolation-CCW
G04Dwell command
G10Programming data input offset
G20Outer/inner dia cutting cycle
G21Thread cutting cycle
G24End face turning cycle
G27Reference point return check
G28Reference point return
G33Threading
G40Tool nose radius comp. Cancel
G41Tool nose radius comp.Left
G42Tool nose radius comp.right
G53Cancel work offset
G54Work coordinate system 1 (optional)
G55Work coordinate system 2 (optional)
G56Work coordinate system 3 (optional)
G57Work coordinate system 4 (optional)
G58Work coordinate system 5 (optional)
G59Work coordinate system 6 (optional)
G65Macro calling
G70Inch programming(Optional)
G71Metric programming (optional)
G72Finishing cycle( optional)
G73Stock removal in turning(Optional)
G74Stock removal n facing(Optional)
G75Pattern repeating(Optional)
G76Peck drilling in z axis (Optional)
G77Grooving in X axis (Optional)
G78multiple thread cutting cycle(Optional)
G90Absolute programming
G91Incremental programming
G92Position preset & spindle speed clamp in css mode during S word.
G94Per minute feed
G95Per revolution feed
G96Constant surface speed
G97Direct RPM programming

Fanuc M codes-Oi-TB

CodesFunction
M00Program stop
M01Optional stop
M02End program
M03Spindle ccw
M04Spindle cw
M05spindle stop
M08Coolant ON
M09Coolant OFF
M10Chuck /Collet Close
M11Chuck / Collet Open
M12Low chucking pressure(Optional)
M13High chucking pressure(Optional)
M18Tailstock swing IN(Optional)
M19Tailstock swing OUT(Optional)
M20Quill LEFT(Optional)
M21Quill RIGHT(Optiional)
M22Turret Index reverse
M23Turret index Forward
M24Steady rest-1 Open(Optional)
M25Steady rest-1 Close(Optional)
M26Steady rest-2 Open(Optional)
M27Steady rest-2 Close(Optional)
M28parts catcher open(Optional)
M29Parts catcher Closr(Optional)
M30Program reset and rewind
M36Cancel M37
M37Ignore upto speed feedhold signal
M40Dry run spindle OFF
M41Dry run spindle ON
M42Dry run cancel
M48Cancel M49
M49Feed rate and Spindle speed overrides inactive
M62Spindle Hold OFF
M63Spindle Hold ON
M76Low quill pressure ON(Optional)
M77Low quill pressure OFF(Optional)
M78Select quill zero pressure(Optional)
M90In position check ON
M91In position check OFF
M92Soft jaw boring
M98Sub program call
M99Sub program end

Programming systems

There are two types of programming mode used in CNC.

  • Absolute
  • Incremental

Incremental progamming mode(G91)

This is the programming mode where the movement (tool/bed/spindle) based on its last(Current) position.

Absolute progamming mode(G90)

This is the programming mode where all the movement measures from Origin point.

Difference between absolute and incremental programming in CNC

Incremental Dimension

Incremental dimension
Incremental Dimension

Absolute dimension

Absolute dimension
Absolute dimension

CNC Positioning System

  • Point To point
  • Continuous path(contouring)

Point to point Positioning

Positioning(tool/spindle/Bed) from one coordinate(X,Y) to another to perform operation like drilling,Boring,reaming,taping..etc.

Continuous path(contouring)

The cutting tool travel from one point to another in Contact with work piece .Example- Turning .Milling

Zero Point Setting

Zero point can be set by any one method.

  • Operator
  • Manually by program
  • Work coordinate

What is work offset in CNC?

This is also called work coordinate.This method is used to set zero point of the machine.Example- G54 X_ Z_.This is for master tool only.For other tool we need to set the tool geometry.

How to set work offset in CNC?

Practical of Work offset setting.-Touch the tool tip on face of raw material/workpiece and go to work offset G54 and set the Z value 0.0.Again touch the tool tip on OD of the work piece and set the X value .That is OD value.

What is Tool geometry offset in CNC?

This is the work offset for individual tool.Work offset required for other tool to perform the different operation.

What is Tool wear offset in CNC?

This offset is used to compensate tool wear.For example if there is 0.1mm of material remain after finishing cut.Then we need to input -0.1 in tool wear section and again to run the finishing cut program to remove remain material.

Interpolation

This method is the movement of Cutting tool from one point to another.

  • Linear
  • Circular
  • Helical
  • Parabolic
  • Cubic

Linear Interpolation(G00/G01)

In this method the cutting tool move in a straight line.

Circular Interpolation(G02/G03)

In this method the cutting tool moves as circle or arc.This is of two types.Clockwise and counter clockwise

Block(CNC information)

Its consists of 5 word written in Horizontal line.This is recognized by MCU((Machine control Unit).

How to cnc programming

Basic of cnc programming-Its contain all the steps of a CNC program

Step-1 : DATUM SETTING

Example:-

G00 G54 G90 G95 X_ Z_;

Step-2 : TOOL CALL

Example;-

T1 D1;

Step-3 : Spindle/Chuck-RPM & Direction

Example:-

M03 S90 ;

Step-4 : Safety Distance

Bring the Tool to a Safety Distance

Step-5 : Main operation

Example:-Turning/Facing/Grooving/Chamfer/Radius

G01 X_ Y_;

Step-6 : Safety Distance

Return the tool to a safety distance.

Step-7 : Spindle /Program Stop

Example:- M05 M30;

CNC programming example-fanuc(Lathe)

O0001(PLAIN TURNING)-Fanuc

N1;                                     Sequence number

T0;                                     Tool wear cancel

G40;                                   Cancelling G41 & G42

G28 U0 W0;                       Home position

G54;                                   Work coordinate

G92 S1000 ;                       Limiting speed

G95 F0.2 T0101;                Feed & Tool

G96 S250 M04;                  Cutting speed & Spindle Rotation

G00 Z 3.0;                           Safety distance for Z axis.-Rapid

G00 X 56.0;                         Safety distance  for X axis-Rapid

G1 X 50.0 M08;               Turning operation &  Coolant ON

G01 Z -40;                           Turning Operation.

G1 X 56.0;     After turning operation  tool will  return to safety distance in feed.

G00 X 200 M09;           Return to safety distance in Rapid & coolant OFF

T0;

G28 U0 W0;                          Return to home position

M01;                                      Optional stop

M30;                                      Program reset

CNC programming example-Siemens(Lathe)

G0 G54 G90 G94 X120 Z2; Datum setting & rapid movement of a tool to a safety distance X120 and Z2

T1 D1 ; Tool Selection

M03 S90 ; Speed and direction

G0 X60 Z2 ; Safety distance

G1 X50 Z0 F0.3; Starting point & feed

G1 X50 Z-220; Turning

G1 X80 Z-220; Turning

G1 X80 Z-565; Turning & end point

G1 X100 F0.4 ; Tool safety

G0 X120; safety distance

G0 Z2; Safety distance

M05 M30; Spindle stop & Program end

CNC programming lathe

Before learning about cnc programming for lathe machine we should know about the Cartesian Coordinate system.From which we can find out the coordinate point for any work piece.We should also learn about WORK CO-ORDINATE,TOOL GEOMETRY,TOOL WEAR.

CNC programming Facing

Raw material size – Diamter-20,Lenght- Any. If we want facing for 2 mm.

Basic of CNC programming-Facing program example

G0 X21.0 Z0.5 ; – Safety distance(Tool will move to 21.0 point in X axis and 0.5 in z axis rapidly ).20.0 is the diameter of raw material and face of work piece is the Z0.0.Tool will stop at Z 0.5 which is the distance from face.This is the suitable safety distance for raw material.After this it will start facing.

G01 Z-1.0 F0.3; – Tool will move to Z -1.0 in feed (Feed you can change)

G01 X 0.0; – Tool will move to X0.0 in feed .This is the facing operation of tool.As the tool start removing material from Z-1.0 to X0.0.That means 1.0 mm of material remove from face of the work piece.

G01 Z0.5; Now tool will move to Z 0.5 in feed.

G00 X21.0; Tool will move rapidly move to X21.0. Next to perform another facing operation.

G01 Z-2.0; Tool will move to Z-2.0 so that it can remove another 1.0 mm material

G01 X0.0; Tool will remove 1.0 mm of material from face of the work piece in this movement.

Now we can again move the tool to Z 0.5 in feed and then X21.0 in rapid.We can use the facing cycle to perform the facing operation.There we have to set the dimension to face and feed.The facing cycle will remove the material as per your requirement.

Basic of CNC programming Turning

If the Raw material having diameter 20 and lenght 30. and we want to make it of diameter 18 upto lenght 15mm.

Basic of cnc programming-Turning program example

G00 Z3.0; – This is the safety distance for Z axis i.e tool will move rapidly and stop at Z3.0.Which is the distance from face.(As face of workpiece is taken Z0.0)

G00 X22.0; – This is the safety distance for X axis.

G01 X19.0; – The tool will move to 19 diameter in X axis in feed. .(This movement is for turning of 1mm i.e upto 19 diameter)

G01 Z-15; – This is the Turning operation.Tool will move from X19.0 to Z-15 with removing material.(Here you can turn ON the coolant)

G01 X22.0; – Tool will move to safety distance of x axis.

In this way you can turn another 1mm.This is the way for turning operation.

Simple programming example.

Learn Hydraulics-Click here.

Learn about Solenoid valve-Visit here.

CNC Operation & Maintenance

Automation CNC practical CNC theory Electrical Fanuc CNC Programming Hydraulic Pneumatics Siemens CNC programming


0 Comments

Leave a Reply

Your email address will not be published.