Sinumerik Programming Basics (828D)
Why Siemens Feels Different
If you grew up on Fanuc, the Sinumerik 828D looks familiar at first glance—G0, G1, G54, G41 all exist—then gets weird fast: programs have names instead of O-numbers, tools are called by name, canned cycles are function calls with parameter lists, and coordinate shifting is done with words like TRANS and AROT instead of G52 and G68. This page is the bridge: the minimum a Fanuc programmer needs to read, edit, and write 828D programs confidently.
Everything here applies to the Sinumerik 828D and its big brother the 840D sl—they share the same programming language.
Program Structure & File Types
Siemens programs are named files, not O-numbers. There are two file types, and workpieces can be grouped into workpiece directories (.WPD) that hold a part's main program, subprograms, and tool data together.
| Extension | Meaning | Fanuc equivalent |
|---|---|---|
.MPF | Main Program File | Main program (O-number you press cycle start on) |
.SPF | SubProgram File | Subprogram called with M98 |
.WPD | Workpiece directory (folder) | No equivalent — a folder holding a part's MPF + SPFs |
Block format is looser than Fanuc: N-numbers are optional, leading zeros are not required (G0 not G00), and decimal points are not needed on whole numbers. Comments start with a semicolon and run to the end of the line:
;**************** Tool change ****************
T="MILLER20" D1 M6 ; this is a comment
G95 FZ=0.14 S3900 M3 M8 ; feed per tooth, spindle on, coolant on
Operator messages: where Fanuc needs #3006 macro trickery, Siemens has MSG() built in. The text displays on the operator panel until cleared or overwritten:
MSG ("FLIP PART - OP20 FIXTURE")
M0 ; hold for the operator
MSG ("") ; clear the message
The Fanuc-to-Siemens Translation Table
This is the heart of it. Most of what you know transfers—you just need the new vocabulary.
| Task | Fanuc | Sinumerik 828D | Notes |
|---|---|---|---|
| Tool call | T1 M6 then G43 H1 | T1 D1 M6 or T="MILLER20" D1 M6 | Tools can be called by number or name. D1 = cutting edge 1's offset set (length AND radius). No G43/H — length comp is automatic once D is active. |
| Length offset | G43 H__ / G49 | Automatic via D | D0 deactivates the offset. |
| Work offsets | G54–G59, G54.1 P1… | G54–G57, G505–G599 | Four standard offsets, then G505–G599 extended (no P word — each is its own G-code). Every offset has a coarse and a fine component. |
| Cancel work offset | (none / G54 default) | G500 | G500 deselects all settable offsets (base frame remains). |
| Machine coords | G53 (one-shot) | G53 (one-shot) / SUPA | SUPA also suppresses programmable frames (TRANS/ROT etc.) — the true "raw machine position" move. |
| Cutter comp | G41/G42 D__ | G41/G42 (no D word) | Radius comes from the active tool's D-edge data. Cancel with G40, same as Fanuc. |
| Canned cycles | G81/G83/G84… + G80 | CYCLE81()/CYCLE83()/CYCLE84()… | Cycles are parameterized function calls, non-modal by default. Make one modal with MCALL; a bare MCALL cancels (the G80 of Siemens). |
| Subprogram call | M98 P1234 L5 | MYSUB P5 | Call by name; P = repeat count. External files via EXTCALL "MYSUB.SPF". |
| Subprogram return | M99 | M17 or RET | RET returns without stopping continuous-path mode; M17 is the classic end. |
| Dwell | G04 P1000 / G04 X1.0 | G4 F1.0 / G4 S10 | F = seconds, S = spindle revolutions. G4 must be in its own block. |
| Inch / metric | G20 / G21 | G70 / G71 or G700 / G710 | G70/G71 convert workpiece positions only; G700/G710 also convert feedrates and technology data. Yes — G71 is metric here, the reverse of Fanuc lathe habits. |
| Rapid / feed | G00 / G01 | G0 / G1 | Identical behavior; leading zeros optional. |
| Feed mode | G94 / G95 | G94 / G95, plus FZ= | Same meaning (per min / per rev); Siemens adds feed-per-tooth with FZ= under G95. |
| Program end (main) | M30 | M30 or M02 | Same. |
| Comments | ( TEXT ) | ; TEXT | Semicolon to end of line. |
| Operator message | #3006=1(TEXT) | MSG ("TEXT") | MSG does not stop the program; add M0 if you need a hold. |
| Block skip | / | / | Same. |
The biggest mental shifts: D is a cutting edge, not a comp register (one tool can carry several D edges, each with its own length and radius), and cycles are subroutine calls, not modal G-codes.
Frames: TRANS, ROT, SCALE, MIRROR
Siemens handles all programmable coordinate shifting through frames. Where Fanuc gives you G52 (local shift) and G68 (rotation) as separate features, Siemens gives you one consistent family of commands that stack on top of the active work offset. The plain form replaces any previous programmable frame; the A-prefixed form is additive to it.
| Command | Effect | Fanuc analog |
|---|---|---|
TRANS X_ Y_ Z_ | Shift the coordinate system (replaces prior frame) | G52 |
ATRANS X_ Y_ Z_ | Additive shift on top of the current frame | Nested G52 (sort of) |
ROT RPL=_ | Rotate in the active plane by angle RPL (replaces) | G68 |
AROT RPL=_ | Additive rotation | — |
SCALE X_ Y_ | Scale per axis (replaces) | G51 |
MIRROR X0 | Mirror about an axis (replaces) | G51.1 |
TRANS (alone) | Cancel all programmable frames | G52 X0 Y0 / G69 |
Example — drill the same 3-hole pattern at two fixture locations, the second one rotated 30 degrees:
G54 G710
T="DRILL10" D1 M6
G94 F500 S1600 M3 M8
TRANS X100 Y50 ; shift origin to pocket 1
HOLES ; subprogram drills pattern at local 0,0
TRANS X250 Y50 ; REPLACES the first shift (not added)
AROT RPL=30 ; then rotate the pattern 30 deg
HOLES
TRANS ; cancel all frames - back to plain G54
G0 Z200 M9
M30
Suppression, from mildest to strongest: G500 deselects the settable work offset (G54–G599), G53 suppresses offsets for one block, and SUPA suppresses everything including programmable frames—use SUPA for tool-change and home moves.
Modal Groups & Key M-Codes
Like Fanuc, one code per G-group can be active at a time, and the control displays active groups in the G-function window. The groups you will actually look at:
| G-group | Contents | Examples |
|---|---|---|
| 1 | Modal motion | G0, G1, G2, G3 |
| 2 | Non-modal motion, dwell | G4, G74, G75 |
| 3 | Programmable offsets (frames) | TRANS, ROT |
| 6 | Plane selection | G17, G18, G19 |
| 7 | Tool radius compensation | G40, G41, G42 |
| 8 | Settable work offset | G54–G57, G505–G599, G500 |
| 9 | Offset suppression | G53, SUPA |
| 10 | Exact stop / continuous path | G60, G64, G641 |
| 13 | Inch / metric | G70, G71, G700, G710 |
| 14 | Absolute / incremental | G90, G91 |
| 15 | Feedrate type | G93, G94, G95 |
M-codes are mostly home turf. Reserved system M-functions on the 828D: M0/M1 stop/optional stop, M2/M17/M30 program end, M3/M4/M5 spindle, M6 tool change, M40–M45 gear ranges. Coolant is machine-dependent but typically M7/M8 on, M9 off.
Cycles Instead of Canned Cycles
Drilling, pocketing, and contour work are done with named cycles—CYCLE81 (center/spot), CYCLE82 (drill), CYCLE83 (peck), CYCLE84 (rigid tap), CYCLE61 (face mill), POCKET3/POCKET4 (rectangular/circular pockets), CYCLE62/63/64 (contour milling). You almost never type the parameter lists by hand: the editor's cycle input screens fill them in graphically, and the resulting call is one line of code you can re-open in the same screen later.
To repeat a cycle at multiple positions, make it modal with MCALL—the cycle then executes at every subsequent position block until a bare MCALL cancels it:
T="DRILL10" D1 M6
G94 F500 S1600 M3 M8
MCALL CYCLE82(50,-10,1,-25,,0,0,1,12) ; drill cycle now modal (like G81)
X15 Y15 ; drills here
X165 Y15 ; and here
X165 Y165 ; and here
MCALL ; cancel (like G80)
G0 Z200 M9
Position patterns can also be defined once with a label and replayed for the next tool using REPEATB—center-drill the pattern, then repeat the identical positions with the drill.
Subprograms
Subprograms are called by name, with an optional P repeat count, and end with M17 or RET. No M98, no P-number lookups:
; main program (PART1.MPF)
G54 G710
T="MILLER10" D1 M6
S8500 M3 M8
HOLES P2 ; call HOLES.SPF, run it twice
M30
; subprogram (HOLES.SPF)
G0 X0 Y0
G1 Z-5 F300
G0 Z5
X20
G1 Z-5
G0 Z50
M17 ; return to caller (Fanuc M99)
Subprograms stored outside NC memory (network drive, USB, CF card) are executed with EXTCALL "NAME.SPF"—the Siemens answer to drip-feeding a subprogram.
ShopMill vs G-Code Programs
The 828D editor can hold two kinds of programs, and both live side by side on the control. A G-code program is what everything above describes—DIN/Siemens code, typically posted from CAM. A ShopMill program (requires the ShopMill/ShopTurn option) is a conversational machining step program built entirely through graphic input screens: a work plan of steps rather than lines of code.
A ShopMill program has three parts: a program header (blank dimensions, retraction planes, and other parameters that affect the whole program), program blocks (the individual machining steps with technology data and positions—technology blocks and position blocks are automatically linked by the control), and an end of program block that can also set repeats. Tool changes, spindle direction, and coolant come from the step screens—no M6 or M3 to type. Bad inputs are caught at entry time instead of at the machine.
| G-code program | ShopMill program | |
|---|---|---|
| Source | CAM post, hand-written | Built at the control via input screens |
| Best for | 3D surfacing, complex parts, anything posted | Prismatic shop-floor work: facing, pockets, hole patterns, quick one-offs |
| Structure | Blocks of code | Work plan: header + linked machining steps + end |
| Tool/spindle/coolant | Programmed (T= D M6, M3, M8) | Handled by the step screens automatically |
| Editability | Full text editing | Re-open any step's input screen; steps can't be pasted into G-code programs |
You can also insert G-code blocks inside a ShopMill program when a step screen can't express what you need—a common pattern is a ShopMill work plan with a few raw G-code lines dropped in.
Worked Example: Face and Drill
A compact but complete 828D program in the style of the Siemens milling manual's own example—face the top, then center-drill and drill a pattern with modal cycles:
;PART_4.MPF
WORKPIECE(,,"","BOX",112,1,-20,-100,-2.5,-2.5,182.5,182.5) ; blank for simulation
G54 G710 G90 ; offset, metric (incl. feeds), absolute
;**************** Face ****************
T="FACING TOOL" D1 M6
G95 FZ=0.1 S3000 M3 M8 ; feed per tooth
CYCLE61(50,1,1,0,-2.5,-2.5,185,185,2,80,0,0.1,31,0,1,10)
G0 Z200 M9
;**************** Spot drill ****************
T="CENTERING TOOL10" D1 M6
G94 F1000 S12000 M3 M8
MCALL CYCLE81(50,-10,1,5,,0,10,1,11)
POS_1: CYCLE802(111111111,111111111,15,15,165,15,165,165,15,165,,,,,,,,,,,0,0,1)
MCALL ; POS_1 labels the position pattern for reuse
G0 Z200 M9
;**************** Drill ****************
T="DRILL10" D1 M6
G94 F500 S1600 M3 M8
MCALL CYCLE82(50,-10,1,-25,,0,0,1,12)
REPEATB POS_1 ; repeat the labeled position pattern
MCALL
G0 Z200 M9
M30
References
- Siemens, SINUMERIK 840D sl / 828D Universal Operating Manual, 08/2018, 6FC5398-6AP41-0BA0.
- Siemens, SINUMERIK 840D sl / 828D Milling Operating Manual, 08/2018, 6FC5398-7CP41-0BA0.
Have a question or want to contribute?
Contact us with corrections, additions, or topics you'd like covered.
Get in Touch