Understanding the g-code program – Smithy Ez-Trol2 User Manual

Page 57

Advertising
background image

www.smithycnc.com

| 51

UNDERSTANDING THE G-CODE PROGRAM

This section of this chapter will look at the blocks of code generated by EZ-Trol, one by one, in
order to illustrate an example of the G-code programming logic that is used by EZ-Trol. It can also
serve as a helpful guide as you determine how you want to develop your own G-code writing style.

NOTE: It is important that a new programmer learn to program, most importantly, in a consistent
manner. It will be much more helpful for the user to review G-code files for errors if the writing
style is consistent from project to project.

N1G40G49G80

(cancel dia. comp, length offset, canned cycles)

Block 1 tells the machine to cancel diameter compensation; tool length offset and canned cycles.
EZ-Trol inserts these words for you when the file is built in the Mill Tab of EZ-Trol. When writing
G-code blocks of code should be included that restore all modal registers to a known state.

N2G17G20

(XY plane, inch mode)

Block 2 tells the machine that we will be working on the XY plane, G21 and G20 tells the machine
we will be working in the units of inches.

N3G53 G0 Z0

(cancel work offsets, rapid, retract quill)

Block 3 tells the machine to use the machine coordinate system to rapidly move the Z axis to zero.
This is the Z axis home position.

N4G54G90G94

(absolute, feed/minute)

Block 4 selects the first of nine coordinate systems with the G54 command. G90 tells the control
that we are doing absolute position programming, not incremental programming, and G94 selects
units per minute format for federate words.

N5G0X0Y0Z2

Block 5 moves the machine rapidly (G0) to the position X0, Y0 and Z2.

N6M05M09

Block 6 turns the spindle on (M05) and M09 turns coolant off.

N7M00T1M06

Block 7 tells the control to pause with M0, which allows us to insert our first tool in the spindle. T1
informs the control that tool number 1 is in the spindle and M06 is the tool change function. M06
doesn’t do very much on a machine without an automatic tool changer but is still necessary.

N8 (*** T1 *** .1562 Twist Drill ***)

Block 8 is a comment informing the operator to do the tool change and to use tool number one.
Once the tool change is complete, left click on the “Resume” button located at the bottom of the
Auto Tab.

N9G00X.2Y1.S1712M03

Block 9 moves the drill rapidly to X.2 and Y1. The spindle speed is set to 1712 and the spindle is
turned on in the forward position, M03.

Advertising