How to Set a P Coordnate CNC Machine
The P address is not an axis. On most controllers it selects which work coordinate system is active, and on lathes it often selects a subprogram or block number instead. This guide shows how to set a p coordnate cnc machine for Fanuc, Siemens and Haas controls, what to verify before cutting, and the mistakes that scrap a first article.

In this article
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
Key takeaways
What the P address means on a CNC controller
P is a parameter letter, not an axis. It carries a number that tells the controller which of several stored data sets to use. That is why the same letter appears in work offset calls, subprogram calls, canned cycles and thread pitches. Before you set a p coordnate cnc machine, read the whole block and decide which of those jobs P is doing on that line.
On a machining center, the common form is G54.1 Pn. Here n is the extended work offset number, running from P1 to P48 on a Fanuc 0i or 30i series control. Together with the standard G54 through G59 offsets, that gives 54 stored zero positions. Each one holds an X, Y, Z and usually a fourth axis value. Switching P switches the whole coordinate frame, so a single program can run six or fifty-four setups.
On a lathe the same letter usually means something else. M98 P1234 calls subprogram O1234. G76 P011060 sets the thread cutting parameters in one packed word. G74 or G84 with a P value sets a dwell or a repeat count. None of these move a work offset. If you edit a P value expecting the part to shift, you may instead change how many times a peck cycle repeats.
There is a third meaning worth knowing. On many controls P also appears as a program number in M98, or as a block number in a branch. The number range is a clue. Work offsets sit between 1 and 48 or 1 and 300 depending on the option. Program numbers are usually four digits starting from 1000 up to 9999. Read the G-code word in front of P and the answer is obvious.
- 1Check the word before PG54.1 means work offset. M98 means subprogram. G76 means thread cycle.
- 2Check the number rangeP1–P48 points to extended offsets. P1000–P9999 points to a program number.
- 3Write it downKeep a setup sheet listing which P value belongs to which vise or fixture.
Set the part zero before you call the P offset
A work offset is only as good as the zero you measured. Find the part zero in X and Y from a drawing datum, not from a convenient edge. On a rectangular block the usual choice is a corner, with the stock faced first so the edge is true. On a turned part the zero is normally the face and the centerline. Write the datum on the setup sheet so the next operator does not guess.
For Z, touch off on the top face with a 10 mm or 0.4 in gauge block, or use a tool setter if the machine has one. Enter the tool length in the geometry page and the part zero in the work offset page. Keep the two separate. Mixing a tool length into a work offset is one of the most common causes of a crash on the second tool.
If the machine has a spindle probe, use it for X, Y and Z on the first part of a run. A Renishaw or Blum routine will find a corner, a bore or a boss and write the result straight into the offset. Repeatability on a clean, deburred surface is usually within 0.005 mm. That is tighter than most manual edge finding, and it removes operator-to-operator variation.
When the same fixture runs the same part every week, store the offset once and lock the page. Fanuc lets you set a work offset write-protect through parameter 3290 or the KEYP switch. Operators can then call G54.1 P3 all day without nudging the numbers. On a production cell this single habit prevents most mid-run size drift.
- 1Face the stock firstA sawn or cast edge is not a datum. Take a 0.3–0.5 mm cleanup cut.
- 2Keep tool length separateGeometry page for tool length, work offset page for part zero.
- 3Protect proven offsetsLock the offset page once a fixture is qualified.
Enter and activate P offsets on Fanuc, Siemens and Haas
On Fanuc, press the OFFSET/SETTING hard key, then the WORK soft key. The screen lists G54 to G59 and, if the extended option is on, G54.1 P1 upward. Use the cursor and page keys to reach the P page. Type the number and press INPUT, then MEASURE for a probed value or INPUT for a typed value. Always switch to the intended offset in MDI and check the absolute position display before running the program.
On Siemens 840D, work offsets are called frames. G54 to G57 are the standard set, and G505 to G599 cover the extended range on most builds. The active frame is shown in the actual-value window. You can shift a frame with $P_UIFR or TRAN, and you can read the current values from the same screen. The logic is the same as Fanuc, but the naming is different enough that a program moved between the two needs a check.
On Haas, press OFFSET, then the Work Zero Offset tab. The list runs G54 to G59 plus G110 to G129 and G154 P1 to P99 on newer controls. Highlight the row, press F1 to set the value from the current position, or type the number and press Enter. Haas also lets you name each offset, which is worth doing on a machine that runs several fixtures in a week.
One rule covers all three brands. The program must call the offset before the first feed move. A block such as G54.1 P5 G0 X0 Y0 places the tool at the stored zero of offset 5. If the G54.1 call is missing, the machine uses whatever offset was active last, and the tool goes to the wrong place. Put the call on the first line after the safety block, every time.
- 1FanucOFFSET/SETTING → WORK → G54.1 P page. INPUT or MEASURE.
- 2Siemens 840DFrames G54–G57 and G505–G599. Check the active frame in the display.
- 3HaasOFFSET → Work Zero Offset → G154 P1–P99. F1 sets from position.
Use G10 to write P offsets from the program
Typing offsets by hand invites a transposed digit. G10 lets the program write the values itself, which is safer on a repeat job. The Fanuc form is G10 L2 Pn X_ Y_ Z_, where n is the offset number. G10 L2 P1 writes G54, G10 L2 P2 writes G55, and G10 L2 P7 writes G54.1 P1 on controls that map the extended set that way. Check the manual for your model, because the mapping is not identical across series.
The values in a G10 line are absolute machine positions, not distances from the previous zero. If you feed it a relative number, the offset lands somewhere unexpected. Read the machine position display in absolute mode, write those numbers down, and use them. For a fixture that repeats every cycle, a G10 block at the top of the program resets the offset to a known value each run.
G10 also handles tool length offsets with G10 L10 or L11, depending on the control. Keep the work offset and tool offset lines in separate blocks so a failed read is easy to spot. On a lights-out cell, the program should call G10, then verify with a probe, then alarm out if the measured position is more than 0.05 mm from the expected value.
Write the G10 lines into the setup section, above the first tool call, and comment them. A line such as (SET G54.1 P3 FOR VISE 2) costs nothing and saves the next person ten minutes. When a job moves to a different machine, the offset numbers travel with the program instead of living only in the operator's memory.
- 1Absolute values onlyG10 L2 uses machine coordinates. Never enter a delta.
- 2One offset per blockKeep work offset and tool offset lines separate for easier troubleshooting.
- 3Probe after G10Verify the written value before the first cutting move.
Checks that catch a bad P offset before the cut
A wrong work offset rarely shows up as a crash. It shows up as a part cut in the wrong place, or a tool that plunges into a fixture. Both are avoidable with three cheap checks. Run them every time a new P value goes into a program, even on a job you have run for months.
First, dry run with rapid override at zero and feed override at zero. Watch the distance-to-go display on each approach move. If the number is larger than the clearance you planned, stop. Second, single block through the first tool change and the first plunge. Third, jog the tool to the expected position by hand and check the gap with a feeler gauge or a gauge block.
Offset errors also show up in the size trend. If every part in a run drifts in one direction, the work offset may be moving. Check whether a G10 line is rewriting it, or whether the offset page is unlocked. If the drift is thermal, the offset is fine and the machine needs a warm-up cycle instead.
Keep a log per machine. Note the date, the P value, the fixture, and the measured first-article size. When a size problem appears six weeks later, the log tells you whether the offset changed or the process did. That is faster than pulling apart the program.
- 1Override zero firstWatch distance-to-go on every approach move before the first cut.
- 2Feeler gauge checkJog to the expected position and measure the gap by hand.
- 3Log every offset changeDate, P value, fixture, first-article size. Six weeks later it pays off.
Common mistakes when setting P coordinates
The most frequent error is a missing offset call. The program runs, but it uses the offset left active by the previous job. The tool goes to a valid position, just the wrong one. Put the G54.1 call in the safety block at the top of every program, even when it seems redundant.
The second is a mixed-up axis sign. On a vertical mill, a positive Z moves the tool away from the part. On a horizontal or a lathe, the sense is different. Enter a Z value with the wrong sign and the first rapid move drives the tool into the stock. Check the sign by jogging one axis by hand before you trust the number.
The third is an unlocked offset page. A bump of the handwheel or a stray keystroke can shift a value by 0.1 mm and nobody notices until the parts are out of tolerance. Lock the page once a fixture is qualified, and unlock it only during a deliberate setup change.
The fourth is treating a lathe P word as a work offset. M98 P1234 and G76 P011060 are not offsets. Editing them to move a part will not work and may change the cycle in ways that are hard to trace. Read the word in front of P every time.
- 1Missing offset callThe program uses the last active offset. Call it in the safety block.
- 2Wrong axis signJog by hand and watch the direction before trusting the number.
- 3Unlocked offset pageLock it once the fixture is qualified.
How to set a p coordnate cnc machine: step by step
- 1Confirm the meaning of P in the blockRead the G-code word in front of P. G54.1 is a work offset, M98 is a subprogram, G76 is a thread cycle. Write it on the setup sheet before touching the control.
- 2Home the machine and check the reference returnRun a full reference return on all axes. Confirm each axis reaches its zero mark and the position display reads 0.000. A skipped reference return throws every offset on the machine out by the lost distance.
- 3Find and mark the part datumFace the stock with a 0.3–0.5 mm cleanup cut. Deburr the edges. Mark the X, Y and Z datum on the drawing and on the setup sheet.
- 4Touch off or probe X, Y and ZUse a 10 mm gauge block or the spindle probe. Aim for a repeatability of 0.01 mm or better on manual touch-off, 0.005 mm with a probe. Record the numbers before entering them.
- 5Write the values into the correct P offset pageFanuc: OFFSET/SETTING → WORK → G54.1 P page. Haas: OFFSET → Work Zero Offset → G154 P row. Siemens: the matching frame. Press INPUT or MEASURE, then re-read the row to confirm.
- 6Call the offset in MDI and verifyType G54.1 Pn G0 X0 Y0. Watch the absolute position display. The tool should sit on the datum you measured. If it is off by a round number, you called the wrong P value.
- 7Dry run the program at rapid override zeroRun in single block with feed and rapid override at zero first. Confirm every tool change and approach move. Then run at 25 percent feed for the first part.
- 8Measure the first article and adjustCheck the critical dimensions. If a feature is off by a constant amount, correct the work offset. If it is off by a varying amount, stop and check the tool and fixture, not the offset.
P offset ranges and call syntax by controller
Values reflect common builds. Confirm against the manual for your specific model and option set.
| Controller | Extended offset call | Typical range | What to check |
|---|---|---|---|
| Fanuc 0i / 30i | G54.1 Pn | P1 to P48 | Extended option must be enabled |
| Fanuc (standard) | G54 to G59 | 6 offsets | Write protect via KEYP switch |
| Siemens 840D | G505 to G599 | Extended frame set | Active frame shown in display |
| Haas (newer) | G154 Pn | P1 to P99 | G110–G129 also available |
| Haas (older) | G110 to G129 | 20 offsets | Row names help on multi-fixture jobs |
| Fanuc lathe | M98 Pn | Program numbers | This P is not a work offset |
| Fanuc turning cycle | G76 Pxxxxxx | Packed parameter word | Two digits per thread field |
Frequently asked questions
Is the P coordinate a real axis on a CNC machine?
No. There is no P axis on a standard 3-axis or 5-axis machine. The linear axes are X, Y and Z, and the rotary axes are usually A, B and C.
P is a parameter letter. It carries a number that selects stored data, such as a work offset index, a subprogram number or a canned-cycle value. When people say P coordinate, they usually mean the extended work offset selected by G54.1 Pn.
How many P work offsets can a Fanuc control hold?
With the extended work offset option enabled, a Fanuc 0i or 30i series control stores G54.1 P1 through P48. That is 48 positions on top of the standard G54 to G59 set.
Some models and option packages support more, so check the offset page on your machine. If the P page is empty or unavailable, the option is not enabled.
What is the difference between G54 and G54.1 P1?
G54 is the first of six standard work offsets. G54.1 P1 is the first of the extended set. Both store an X, Y, Z and usually a fourth-axis value.
Functionally they behave the same way. The extended set simply gives you more positions, which matters on a machine running many fixtures or a pallet pool.
Can I set a P offset with a probe instead of touching off by hand?
Yes, and on a production job it is the better choice. A spindle probe routine can find a corner, a bore or a boss and write the result straight into the offset.
Repeatability on a clean, deburred surface is usually within 0.005 mm. That is tighter than manual edge finding and removes operator-to-operator variation.
Why did my part move after I edited a P value in the program?
Check what the P value controls. If it sits after G54.1, it selects a work offset. If it sits after M98, it selects a subprogram. If it sits inside a G76 line, it sets thread parameters.
Editing the wrong one changes a cycle parameter, not the part position. Read the G-code word in front of P before you change the number.
How often should a P work offset be rechecked?
Recheck it whenever the fixture is removed and refitted, whenever a crash or a hard stop occurs, and at the start of a long production run.
For a fixture that stays on the machine, a weekly dial test on a known feature is enough. Log the reading so you can see drift before it becomes a size problem.
Send us your drawing and setup questions
We run 127 high-precision CNC machines, including 16 simultaneous 5-axis centers, and hold ±0.005 mm on production parts. Quotation and free DFM analysis come back within 12 hours.
12-hour quote100% inspectionNo minimum order quantityNDA on request