General Instructions for G-Codes and M-Codes

Some of the following instructions may be machine dependent also. So, the respective machines manuals may need to be consulted in some cases are as follows:

a. G or M codes can be optionally prefixed with an N block number. Block numbers may be in ascending or descending order. All the blocks need not have respective line numbers. Repetition of line numbers is permitted, although it is not recommended.

b.The S value specifies the new RPM for the spindle (CW or CCW). If the spindle is on, it will now spin at the new speed in the same sense.

c. Examples: M03 S1200 (sets the spindle speed to 1200 RPM and turns the spindle on, CW)
d.G01 X 10 Z1 S1000 (sets the spindle speed to 1000 RPM, CW or CCW depending on whether M03 or M04 was invoked last, and then performs the linear move.)

Constant Surface Speed ON. The S value specifies the surface speed of the tool. This is in meters (or feet) per minute. To maintain this surface speed, the spindle RPM is continuously updated, subject to a maximum limit defined by G50.

Note: Except for the threading commands, the F value refers to the feed rate. There are 2 modes - feed per minute and feed per revolution.

Feed Per Minute. This is the default mode. When an F is mentioned in a block, the current feed rate is changed to the value specified by F. G98 sets feed per minute mode.
Example: G98 F50.0 (sets a feed rate of 50 mm per minute)

Feed Per Revolution. In this mode, the feed rate (i.e., feed per minute) is set to the spindle RPM multiplied by the current feed per revolution value, F. G99 sets feed per revolution mode.
Example: G99 G01 Z-10.05100 Fl.5 (sets the feed rate to 150 mm per minute)

X Axis Positioning. The X value is for an absolute position. The U value is for a position relative to the current position. If diameter programming is active then these values refer to the diameter instead of the radius. Diameter programming mode is the default and used everywhere in this text

Z Axis Positioning. The Z value is for an absolute position. The W value is for a position relative to the current position.
a. The centre of the right face of the work piece is taken as the component zero point (i.e., X0 Z0) in all the turning examples in this book.
b. In circular interpolation (G02 or G03), instead of the arc radius R, the arc centre can be specified relative to the arc start point. The I and K values place the arc centre on the X and Z axes, respectively. If a value is not specified, it defaults to 0. The I value is specified as a radial distance.

G00 X0 Z0
G03 X 30 Z -15 R15 G00 X0 Z0
G03 X30 Z -15 I0 K -15 G00 X0 Z0
G03 X30 Z -15 K-15
(All the three execute the same CCW arc)

c. Care must be taken to ensure that the lathe turret has desired types of tools at desired locations. The location number on the turret is the same as the tool number of the program. For simulation also, proper tools have to be selected to see the expected effect.

d. The machine does not know where the component zero point is located. The tool tip is brought to this point manually and its coordinate values (0, 0) are fed. This process is called setting tool offset and has to be done for all the tools separately which are to be used in machining. In practice, the tool is made to touch the cylindrical surface, and the diameter at that location is fed as X value. This sets the XO line indirectly. For setting the Z0 line, the tool is made to touch the face of the job. This information can be saved in a tool offsets file for future use.

e.  If the tool nose radius compensation is not invoked, the profile obtained after machining will be slightly over-size.

f. For proper visualization and analysis of the machining operation, the software usually provide several user friendly features such as message window, step-by-step execution ON/OFF, comment lines, error diagnosis, 3-D visualization, sectioned views etc.

No comments