2.9 Reading a Main Program and Its Words
Key Takeaways
An O number identifies the program. An N number can identify a block within it.
Read every block with its active units, feed mode, work and tool offsets, and motion mode.
Use the completion sequence to establish a verified safe position and the intended spindle and coolant state.
2.9 Reading a Main Program and Its Words
Read beyond the cutting line
The Haas mill manual organizes a typical main program into preparation, cutting and completion. Preparation sets up the tool and operating state. Cutting orders the path with its feed. Completion withdraws the tool along the intended path and leaves the machine in the required state. A file with valid syntax can still be for a different revision, fixture or origin. Match the program identifier and release to the setup sheet before entering the first block.
In the Haas text program format shown below, percent markers delimit the text file. The letter O introduces the numeric program identifier. Parentheses identify comments. An N address can number a block, and inserted numbers help reference locations. The address word X0.500 names an axis and a value; its meaning depends on the active units and distance mode. Empty comments and block numbers do not set those modes. In a published example an end-of-block semicolon may be displayed. Read the actual format accepted by the control and transfer method.
| Address in the example | What to check |
|---|---|
| O and N | Program identity versus number attached to a block. |
| T and H | Selected tool versus length-offset register. Match the two where the program or control expects agreement. |
| G and M | Preparatory mode or function versus an auxiliary action. Haas permits multiple compatible G words from different groups and one M word per block. |
| X, Y and Z | Axis values under the relevant position, unit and reference assumptions. |
| S and F | Requested spindle speed and feed. On these blocks S is in rpm and G94 with G20 gives F in inches per minute. |
Trace a short main program in graphics
Consider the following graphics-reading exercise. The setup sheet identifies a one-pass example with a flat stock top at G54 Z0, a prepared entry at X0.000 Y0.000, a suitable tool in pocket 1 and a verified H01. For the physical job, the setup must verify the initial positioning and tool change, the G43 move at the starting XY location, the Z0.750 crossing and clearance of the complete fixture and tool assembly. The example's speed and feeds are assigned practice data.
%
O01234 (TRACE EXERCISE)
N10 G20 G17 G90 G94 G40 G80 G54
N20 T01 M06
N30 S1800 M03
N40 G00 G43 H01 Z0.750
N50 X0.000 Y0.000
N60 M08
N70 G01 Z-0.040 F4.0
N80 X0.500 Y0.250 F12.0
N90 G00 Z0.750
N100 M09
N110 M05
N120 M30
%
N10 through N60 prepare the state. N40 calls the specified tool length combined with the programmed position. N50 retains G00 because no new motion code changes it; read pause or mode effects separately on the installed control. N70 changes the motion to G01 and feeds to the stated depth from the verified start. N80 is still G01. Its X and Y move to the given positions relative to G54, while Z has no new command and remains at −0.040 in. The new feed is 12.0 in/min. If F12.0 were removed while G01 and the same feed mode remain active, the programmed 4.0 in/min from N70 would carry forward. A programmer should establish the needed feed before the move that relies on it. The next block withdraws to Z+0.750 in, a commanded Z change of +0.790 in from the cut depth. Coolant and spindle are then stopped in their own blocks and M30 ends the main program. The remaining physical access depends on the actual stop and safe-access procedure.
Identify what to prove before motion
A missing active state can change an otherwise familiar block. In G91, the linear values at N80 would be movements rather than absolute endpoints. The missing Z word still does not move Z. In a different setup whose current X is +0.250 before the same block, G90 would reach X+0.500 while G91 would reach X+0.750. Resolve the needed modes at the appropriate program point and verify the tool, fixture and model settings before physical use. An apparent arithmetic match at one starting point does not prove the block behaves as intended elsewhere.
In the shown program what is the difference between O01234 and N80?
O01234 identifies the program and N80 numbers a block
O01234 is a work-offset register and N80 sets feed
Both select alternative length offsets
N80 changes the file name and O01234 is an X move
Which Z position is commanded by the end of N80 in the stated exercise?
Z+0.750 in
Z0 because only X and Y were programmed
Z−0.040 in remains unchanged
Z−0.080 in because G01 repeats the last whole block
The current X position is +0.250 in and G91 is active. What X position does an ordinary G01 X0.500 block reach?
X+0.500 in
X+0.750 in
X−0.250 in
X+0.250 in
Why is checking the N90 retract part of the completion review?
M30 proves any programmed path has safe clearance
The start of a program determines all exit paths
Tool movement is only possible in cutting blocks
The withdraw path and clearance require verification before declaring the final stop state safe
Sections you finish are checked off in the contents.