Search This Blog

Wednesday, June 11, 2014

Introduction to G-CODES CNC Programming.


Introduction to G-CODES used in CNC Programming


A G-code is defined using the G address letter and a two digit number in NC Programming, example: G00

G-Code is mostly used common name in NC Programming language since they prepare the machine for a certain type of motion. G-codes instruct the machine where to move, how fast to move and which path to move. G-codes are called as Preparatory codes which prepare machine to move.

There are two types of G-codes,

1)      Modal G-code.


2)       Non-Modal G-code.


1). Modal G-code: the G-codes for motions are called Modal G-code. The modal G-code once called it stays till it is cancelled with another G-code.  If G1 (Linear Move) command is called it will be executed again on the next line unless some other command called which cancels G1. 

                Additionally, modal G codes are further split into groups according to their task and function. A modal G code will remain active until another G code from the same group is programmed into a block, or it is cancelled. Example units of programming inches (G21) and millimetres (G20) are modal. Model groups are as shown below.


Group 1
{G0, G1, G2, G3, G80, G81, G82, G83, G84, G85, G86, G87, G88, G89} - motion
Group 2
{G17, G18, G19} - plane selection
Group 3
{G90, G91} - distance mode
Group 5
{G93, G94} - spindle speed mode
Group 6
{G20, G21} - units
Group 7
{G40, G41, G42} - cutter diameter compensation
Group 8
{G43, G49} - tool length offset
Group 10
{G98, G99} - return mode in canned cycles
Group 12
{G54, G55, G56, G57, G58, G59, G59.1, G59.2, G59.3} coordinate system selection


2). Non-Modal G-codes: The Non-Modal G-codes effect only the lines on which they occur. Example: G04 (Dwell) is Non-Modal. The machine suspends machine motions code, dwells for the programmed time, and then returns to normal movements.