Estimated reading time: 7 minutes
What Will You Learn in This Lesson?
In this lesson you will learn:
- how to read the information on the FANUC program screen,
- how to tell the active block from the block being executed,
- how to check the G, M, S, T and F addresses,
- how to follow the modal G codes,
- the G70-G76, G96 and G97 functions specific to turning,
- the G54-G59 and G81-G89 functions specific to milling,
- the fields the operator must check in cycle lines.
This lesson does not teach all the G and M codes. The aim is to explain where the program commands are seen on the FANUC screen and what the operator should verify before running the program.
Opening the FANUC Program Screen
The programs in the CNC memory are generally displayed with the PROG function key.
Depending on the control series, the following screens may be met:
- Program content
- Active program
- Program check or CHECK screen
- Program list
- MDI program
- Active G codes
- Next program block
- Modal status information
The program screen mostly contains the following information:
O: the program numberN: the sequence number- The word where the cursor is
- The program block being executed
- The active operating mode
- The active G codes
- The M, S, T and F information
- Whether the program is running or waiting
Do Not Confuse the Cursor with the Block Being Executed
In EDIT mode the cursor on the screen shows the word or block to be edited. In MEMORY/AUTO mode the screen may show the program block being executed with a different colour or highlight.
These two positions do not have to be the same:
- Cursor: the editing or inspection position selected by the operator on the screen
- Block being executed: the program line the CNC is processing at that moment
Some controls may show the next block together with the current one. The FANUC control can also read program blocks in advance. For this reason it should not be decided which command the machine is executing by looking only at the line where the cursor is.
The operator should check these three items together:
- The active O program
- The N sequence number being executed
- The active block highlighted on the screen
Reading the Program Addresses
An example program block may look like this:
N100 G01 X50.0 Z-20.0 F0.20;In this line:
N100: the sequence numberG01: the preparatory function that determines the type of movementX50.0andZ-20.0: the target coordinatesF0.20: the feed value;: end of block
In another block the following addresses may be seen:
M: an auxiliary machine functionS: a value related to the spindleT: tool or tool-offset selectionH: on a milling machine, mostly the tool length offset numberD: on a milling machine, mostly the cutter radius offset numberP,Q,R: auxiliary addresses that carry different tasks depending on the cycle
The meaning of a letter may not be the same in all G codes. For example R may indicate an arc radius in one block, and a retract level or a different cycle value in another.
For this reason an address should not be evaluated by its letter alone, but together with the G code it belongs to and the context of the program.
G Codes and Modal State
G codes tell the FANUC control the working states such as movement, coordinate system, feed form or cycle.
Some G codes are effective only in the block they are in. Others stay active until they are replaced by another code or cancelled. These are called modal G codes.
For example, the control may be holding the following states selected in earlier blocks of the program:
- Movement mode
- Coordinate system
- Plane selection
- Feed form
- Fixed cycle
- Tool compensation
- Spindle speed mode
On some FANUC controls the active G codes can be seen from the MODAL, CHECK or similar pages on the program, position or control screen.
Common mistake: reading only the single line to be executed. The behaviour of the block can be affected by modal G codes selected earlier.
If the program is to be started from the middle, it should be checked in particular in which earlier blocks the necessary modal states were established.
M, S, T and F Information
On the FANUC screen, the active or commanded M, S, T and F information may be shown separately from the program line.
The M code
M codes call auxiliary machine functions. Common examples:
M00: programmed stopM01: optional stopM03andM04: spindle rotation directionsM05: spindle stopM30: end of program and restart operation
However, the M codes belonging to the chuck, tailstock, turret, live tooling, pallet, magazine and coolant functions in particular can be determined by the machine tool builder.
An M code that performs a particular task on one machine may carry a different function on another.
The S information
S is mostly the command value related to the spindle speed. On a lathe, while G96 is used the S value in the program can mean the cutting speed; while G97 is used it indicates the value in revolutions per minute.
For this reason the commanded S value seen on the screen and the real spindle speed may not be the same thing.
The T information
T indicates the tool selection. On a lathe the tool and the offset number can be contained in the same T code. On a milling machine the T code selects the tool while the tool change is applied separately with a command such as M06.
The F information
F is the programmed feed value. Whether the value is feed per minute or feed per revolution depends on the active feed mode.
The feed mode codes may be different in the FANUC lathe G code system and the FANUC milling G code system. The unit of the F value should not be assumed without checking the active G codes.
Program Checking on a FANUC Lathe
G96 and G97
The common usage on a FANUC lathe is as follows:
G96: activates constant surface speed control.G97: selects constant spindle speed and cancels G96.
Example:
G96 S180;In this line S180 is the constant cutting speed value according to the programming unit of the control. As the X position changes, the control may change the spindle speed in order to maintain the cutting speed.
Example:
G97 S1200;In this line a constant speed command is given for the spindle.
The operator should check the following:
- Is G96 or G97 active?
- In which sense is the S value in the program being used?
- What is the real spindle speed on the screen?
- Has a maximum speed limit been defined?
- Are the chuck, the workholding and the equipment used suitable for this speed?
Caution: while G96 is active, the calculated speed can rise very high as the tool approaches the centre axis. For this reason the maximum spindle speed limit is a critical check.
The Maximum Spindle Speed Limit
In FANUC lathe G code system A, the maximum spindle speed is mostly limited in the following form:
G50 S2500;This example aims to prevent the control from raising the spindle speed above the set upper value during G96.
In FANUC G code system B or C a different G code may be used for the same task. In some systems G92 may correspond to this function.
For this reason the operator should verify:
- the G code system used by the control,
- the speed limit line in the program,
- the real spindle speed on the screen,
- the permitted limit of the machine and the workholding elements.
G70-G76 Turning Cycles
In FANUC turning programs, the codes in the G70-G76 range can be used for cycles such as finishing, roughing, pattern repeating, grooving/drilling and threading, depending on the G code system used.
In the common FANUC G code system A layout:
G70: finishing cycleG71: longitudinal roughing cycleG72: facing direction roughing cycleG73: pattern repeating cycleG74: grooving or peck drilling type cycleG75: outside/inside diameter grooving type cycleG76: multiple threading cycle
This lesson does not teach the metal removal logic of the cycles. From the operator’s point of view, the points to be checked are:
- Has the correct cycle code been used?
- Do the P and Q sequence numbers called by the cycle exist in the program?
- Are the profile blocks between P and Q in the correct order?
- Are the signs of the X, Z, U and W values correct?
- Are the F, P, Q and R values suitable for the cycle format being used?
- Is the start position safe?
- Is the finishing or threading cycle working with the correct offset?
Special attention for G76
For the G76 threading cycle:
- the one-line or two-line format,
- the meaning of the P, Q and R addresses,
- the way decimals are used,
- the unit of the depth and pass values
may change according to the control series and the supported cycle format.
A G76 line should not be copied from another FANUC machine without verification.
In the same way, the numbers or detailed formats of the G70-G75 codes may differ between G code systems A, B and C.
Program Checking on a FANUC Milling Machine / Machining Centre
G54-G59 Workpiece Coordinates
In a FANUC milling program, G54 to G59 select one of the workpiece coordinate systems on the Work Offset screen.
Example:
G54When this command is given, the control uses the X, Y and Z values in the G54 row of the Work Offset table.
The operator should check this match:
- Which G54-G59 system does the program call?
- Into which offset row was the part setup measured?
- Are the X, Y and Z values in the selected row correct?
- Is another Work Offset selected in the middle of the program?
Even if the G54 values are correct, if the program calls G55 the tool may move according to the wrong coordinate system.
G81-G89 Drilling Cycles
On FANUC milling and machining centre controls, the G81-G89 range is commonly used for hole machining fixed cycles.
Depending on the type of cycle, the following addresses may be present in the block:
X,Y: the hole positionZ: the machining depth or target planeR: the approach/retract planeQ: the peck amountP: the dwell time or a cycle-specific valueF: the feedLorK: the number of repeats, depending on the control system
A representative line:
G81 X40. Y25. Z-15. R2. F120;This line is only a screen reading example; it is not a ready program to be used directly on a machine.
The operator should make the following checks:
- Is the active Work Offset correct?
- Are the correct tool and H offset active?
- Are the X and Y hole positions correct?
- Is the Z target value safe?
- Is the R plane above the part and the workholding elements?
- Is the F feed value suitable?
- Is the cycle cancelled with G80 in the correct place?
- Is the G98 or G99 return selection correct?
In the standard FANUC milling G code system:
G98: generally return to the initial plane of the cycleG99: generally return to the R plane
These codes should not be confused with the G98/G99 feed meanings in FANUC lathe G code system A. The same G code can carry a different task on a lathe control and on a milling control.
Checking the Tool Offsets from the Program
In a milling program the tool call, the length offset and the radius offset can be managed with separate addresses:
T01 M06
G43 H01
G41 D01The operator should compare the following:
- Which tool has been physically called?
- Which Tool Length Offset row does the
Hnumber select? - Which Cutter Radius Offset row does the
Dnumber select? - Are the offset cancel commands (
G49,G40) in the correct place in the program? - Do the active tool and offset details on the screen show the expected values?
It should not be assumed that the H and D numbers will automatically be 01 because the tool is T01.
The Order to Follow When Checking a Program
The following order of checks can be applied before a program is run:
- Verify the active O program.
- Read the opening blocks of the program.
- Compare the active and the programmed G codes.
- Check the tool against the T, H or D numbers.
- Determine in which mode the S and F values will be used.
- In a turning program, check G96/G97 and the maximum speed limit.
- In a milling program, verify the active G54-G59 Work Offset.
- Compare the P, Q, R and other addresses of the cycles with the relevant control manual.
- Check that the cycle cancellation is in the correct place.
- Verify the program with graphics, Single Block and low percentage settings.
Graphics, Dry Run and program restart operations will be covered in detail in Lesson 10.
FANUC Note
FANUC lathe controls may use G code system A, B or C. The task of a G code with the same number, or the cycle format, may differ between the systems. The G50/G92, G70-G76 and G76 writing format in particular should be verified.
A significant part of the M codes depends on the PMC configuration of the machine tool builder rather than on the FANUC control. An M code from another machine should not be copied just because the FANUC control model is similar.
Short Summary
- The PROG screen allows the active program and the executed blocks to be followed.
- The cursor position and the program block being executed are not the same thing.
- G codes should be evaluated together with the modal states left over from earlier blocks.
- Part of the M codes is specific to the machine tool builder.
- On a lathe, G96 is the constant surface speed mode and G97 the constant spindle speed mode.
- The maximum speed limit should be checked before G96 is used.
- The format of the G70-G76 cycles should be verified against the FANUC G code system in use.
- On a milling machine the G54-G59 selection in the program must match the Work Offset screen.
- In G81-G89 cycles the Z, R, Q, P and F values should be checked carefully.
- The same G code can carry a different meaning on a lathe and on a milling machine.
Test Yourself
- What is the difference between the program cursor and the block being executed?
- What does a modal G code mean?
- Why should M codes not be copied directly from another machine?
- Which spindle working modes do G96 and G97 select?
- Why is the maximum speed limit important during G96?
- Can it be accepted that G50 has the same task on every FANUC lathe system?
- What do the P and Q addresses generally relate in the G71 cycle?
- Why should a G76 line be verified against the relevant control manual?
- Which screen data does the G54 command in a milling program select?
- Why should the R and Z values in G81-G89 cycles be checked in particular?
- Do the G98/G99 codes carry the same meaning on a lathe and on a milling machine?
- When T01 is called, can it be assumed that H01 and D01 will be used automatically?