Overview
This technical reference documents the procedure for assigning a machine axis to a handwheel directly from a running NC program on a SINUMERIK 840D sl controller. The specific application target is an electron beam welding (EBW) machine where one CNC axis (the beam-generator X-axis) must be released from the interpolator during a welding cycle and driven manually by the operator with a handwheel, while the remaining programmed axes (A-axis rotary positioner, Y, Z) continue to execute the part program. The result is a hybrid mode: programmed motion for the positioner plus synchronous, real-time manual correction on the beam axis to follow the weld seam as the joint geometry is consumed or as the operator compensates for fit-up variation.
The mechanism that makes this possible on a SINUMERIK 840D sl is the DRF (Differential Resolver Function / Handwheel Offset) in combination with machine-specific M-codes and GUD/H-variable parameters that activate the handwheel input and select the increment per pulse. The DRF function is documented in the SINUMERIK 840D sl Functions Manual - Axes and Spindles (FB2) and the SINUMERIK 840D sl Operator Components and Networking manual. This article consolidates the configuration, programming, and verification steps required to make the assignment work end-to-end.
Application Context: Electron Beam Welding with Manual Seam Tracking
On a Probeam-style EBW machine, the welding head sits on a CNC positioning system (X, Y, Z) and the workpiece is rotated on a CNC positioner (A-axis). During a weld the A-axis is commanded to spin at a programmed surface speed while the X-axis is supposed to follow the seam (a circumferential or axial path on a cylindrical or contoured workpiece). The ideal CNC program would compute the X traverse from the A-angle and the workpiece geometry, but:
- Real workpieces have stack-up tolerance, weld shrinkage, and thermal distortion that cannot be pre-modeled.
- Operators prefer to watch the molten pool through the EBW optical viewport and steer the beam by feel to keep it centered on the seam.
- The seam is often visible as a thermal or optical feature, so 1:1 tracking is required with no interpolation lag.
Releasing the X-axis to the handwheel (with the A-axis still under program control) gives the operator a closed-loop, low-latency manual correction channel. The DRF function is exactly the mechanism Siemens designed for this kind of operator-in-the-loop correction in AUTOMATIC mode.
Prerequisites
Before the in-program handwheel assignment can be activated, the following must be true on the controller:
- Handwheel hardware installed and wired to one of the SINUMERIK handwheel inputs. The 840D sl supports up to two electronic handwheels (typically via the PP 72/48 I/O module and the IHN 030/031 handwheel encoder, or via a panel-mounted handwheel on an HT 2 / HT 8 / OP 010 / OP 010C / OP 012 / OP 015 / OP 019 panel front). See the Operator Components and Networking manual for the wiring diagrams and connector pinouts.
- Handwheel assigned to the target machine axis in the axis configuration. The relevant machine data are listed in the table below.
- Handwheel selected as the active source for the assigned axis in the PLC interface (DB31, ... DBX30.0 / DBX30.1 / DBX30.2) or by the operator panel key Handwheel.
-
DRF enable set in machine data
MD20150 $MC_GCODE_DEFAULT_VALUES[8](default = 0; must be set to 1 in some configurations to allow DRF to remain active across mode changes). -
Channel-specific DRF enable in setting data
SD41600 $SC_HANDWHEEL_SEGMENTand the related handwheel-increment parameters listed below. - Channel reset or NC START clear conditions satisfied: the handwheel offset (DRF) is cleared at reset by default, so the M86 line must be inside the part program, not as a pre-block.
SINUMERIK 840D sl Handwheel Architecture
The 840D sl has three handwheel input paths:
| Path | Source | Used For |
|---|---|---|
| Electronic handwheels on the operator panel front (e.g., HT 8) | HT 8 / HT 10 / built-in handwheels | JOG and handwheel-selected mode |
| External handwheel via the IHN 030/031 module on the PP 72/48 | Encoder signal, RS-422 differential | JOG and DRF in AUTOMATIC |
| Virtual handwheel (HMI softkey on the operator panel) | Mouse / HMI screen button | Test and commissioning |
For a welding-cell application the external handwheel is normally used because the operator stands at the viewport, not at the operator panel. The IHN 030 or IHN 031 module decodes the encoder pulses and forwards them to the NC kernel, which adds the pulses to the position setpoint of the selected axis. The selection of which axis the handwheel drives is done in the PLC interface area:
| Signal | DB | Bit | Meaning |
|---|---|---|---|
| Activate handwheel 1 | DB31, ... DBX30.0 | Bit 0 | Handwheel 1 drives this axis |
| Activate handwheel 2 | DB31, ... DBX30.1 | Bit 1 | Handwheel 2 drives this axis |
| Neg. direction simulated handwheel | DB31, ... DBX30.2 | Bit 2 | Negative direction for simulated pulses |
| Handwheel direction inverted | DB31, ... DBX30.3 | Bit 3 | Invert the handwheel sign |
| Request axis enable / follow-up | DB31, ... DBX1.7 | Bit 7 | Drive enable for handwheel pulses |
These are the same signals that the JOG-mode axis-selection keys drive, which is why the operator can move the X-axis with the handwheel in JOG once the wiring and PLC interface are correct. The DRF function in AUTOMATIC mode uses the same signal path but superimposes the pulses on the programmed command position.
DRF Function - Theory of Operation
DRF is enabled in AUTOMATIC and MDI modes (and on some machines in JOG) by either:
- Programming the function in the part program (the path used for the EBW application), or
- Activating it from the HMI (operator panel key DRF or via the softkey Handwheel / DRF).
Once DRF is active, every handwheel pulse on the assigned axis is converted to an incremental position offset that is added to the axis command value. The size of the increment per pulse is governed by the increment weighting machine data:
| MD/SD | Name | Default | Meaning |
|---|---|---|---|
| MD31090 $MA_JOG_INCR_WEIGHT | Increment weighting for JOG/handwheel | 0.001 mm / 0.001 deg | Distance per handwheel pulse |
| SD41010 $SN_JOG_SET_SPEED | Dry-run feedrate | 0 | Not used for DRF |
| SD41600 $SC_HANDWHEEL_SEGMENT | Handwheel segment | 0 | 1 = fine, 5 = coarse, etc. |
| SD41610 $SC_HANDWHEEL_STOP | Handwheel stop at block end | 0 | 0 = pulses active across block boundaries |
| MD20150 $MC_GCODE_DEFAULT_VALUES[8] | Default for G code group 8 (DRF on/off) | 0 | 0 = DRF off, 1 = DRF on at reset |
The offset is stored in the axis-specific DRF display variable. It is displayed in the HMI position window with a D suffix to distinguish it from the programmed position. The DRF offset is cleared by:
- Channel reset (RESET key or M30), unless
MD20150is set to keep it. - Programming the DRF clear cycle.
- Selecting a different axis at the HMI.
Step-by-Step: In-Program Handwheel Assignment
The following procedure activates handwheel steering of the X-axis while a part program is executing. The syntax below uses the Probeam EBW convention; on other 840D sl machines the M-code and H-variable names may differ, but the principle is identical.
Step 1 - Confirm the handwheel is wired and tested in JOG
Switch to JOG, select the X-axis, and verify the handwheel moves X by the configured increment. If JOG handwheel motion does not work, do not continue; the DRF function will also fail. Check:
- Encoder wiring on the IHN 030/031 module (RS-422 A/A\, B/B\, 5 V supply).
- Machine data
MD11350 $MN_HANDWHEEL_SEGMENTandMD11352 $MN_HANDWHEEL_ACTIVE(general handwheel enable). - Axis-specific assignment
MD11352 $MA_HANDWHEEL_ASSIGN(per-axis assignment of handwheel 1, 2, or none). - PLC interface bits DB31, ... DBX30.0 (handwheel 1) and DBX30.1 (handwheel 2) for the X-axis slot.
Step 2 - Enable DRF at the channel level
DRF must be enabled in the active channel. The standard Siemens approach is to set the G-code default for group 8, or to use the M-code that the machine builder has provided. On the Probeam EBW the M-code that activates DRF and switches the handwheel source to the X-axis is M86. Activate it inside the part program with a separate block, ideally with a dwell or auxiliary function so the NC kernel has time to update the handwheel table before motion starts:
M86 ; Activate DRF / handwheel input on this channel (machine-specific M-code)
Step 3 - Select the handwheel increment
Two GUD/H variables (named H88 and H89 in the Probeam machine builder definition) drive the increment selection:
-
H88 = 1selects the fine increment (typically 0.001 mm / 0.001 deg per pulse). -
H89 = 10selects the coarse increment (10x the fine increment, i.e. 0.01 mm / 0.01 deg per pulse).
On the 840D sl the increment select is implemented through the $AC_HANDWHEEL_SEGMENT[axis] runtime variable or, on machines that expose it as a GUD, the H-variable pair. The values 1 and 10 in H88/H89 are the segment numbers; the actual displacement per pulse is still defined by MD31090. Setting both H88 and H89 to 1 is equivalent to selecting the fine increment, while setting H89 to 10 selects 10x. A typical setup block is:
H88=1 ; segment 1 = fine increment
H89=10 ; segment 10 = 10x increment (operator can toggle via HMI softkey)
These H variables are Probeam-specific; on a generic 840D sl the equivalent is to write $AC_HANDWHEEL_SEGMENT[X]=1 or to use the SD41600 $SC_HANDWHEEL_SEGMENT setting data. Some machine builders also expose the increment selection as GUD GV_HW_INC_FINE and GV_HW_INC_COARSE.
Step 4 - Combine into a working block sequence
Putting the three lines together gives the proven working sequence reported in the original application:
; --- pre-weld: position axes, set up handwheel ---
N10 G0 X0 Y0 Z0 A0 ; rapid to weld start
N20 H88=1 ; handwheel segment 1 (fine)
N30 H89=10 ; handwheel segment 10 (10x)
N40 M86 ; activate DRF / handwheel assignment for X
N50 G1 G64 F50 A360 ; start A-axis rotation, F = degrees/s
; --- weld cycle: A rotates, X is handwheel-corrected ---
N60 X0 ; programmed X target (operator steers via DRF)
N70 G4 F2 ; dwell 2 s to confirm weld initiation
N80 M87 ; optional: deactivate DRF at weld end
N90 M30 ; end of program, DRF cleared at reset
The block sequence is exactly the pattern that the user reported as working: H88=1 / H89=10 / M86 as a pre-move block, followed by the A-axis rotation block, with the X target block executed while DRF is active. The handwheel pulses superimpose on the X motion, so the operator can pull X off the programmed path by 0.001 mm per pulse (fine) or 0.01 mm per pulse (coarse).
Step 5 - Use G91 with handwheel for incremental steering
If the operator wants the handwheel to move the X-axis without any programmed X motion, the simplest approach is to program X in incremental mode and combine it with DRF. Each handwheel pulse then advances the X position by the increment size:
N100 G91 ; incremental
N110 X0 ; null move; DRF drives the motion
N120 G4 F1 ; dwell 1 s to allow pulse counting
This is useful at the start of a weld when the operator wants to walk the beam to the seam edge before the A-axis rotation begins.
Machine Data and Setting Data Reference
Consolidated reference for the machine data and setting data that must be present for the procedure to work. Values shown are common defaults; verify against the actual machine data sheet before applying.
| Number | Name | Typical Value | Purpose |
|---|---|---|---|
| MD10000 $MN_AXCONF_MACHAX_NAME_TAB[0..4] | Machine axis names | X1 Y1 Z1 A1 SP1 | Logical axis names (X, Y, Z, A, SP) |
| MD11350 $MN_HANDWHEEL_SEGMENT | Handwheel hardware segment | 1 | Encoder segment for handwheel 1 |
| MD11352 $MN_HANDWHEEL_ACTIVE | Handwheel globally active | 1 | Must be 1 to enable any handwheel function |
| MD11353 $MN_HANDWHEEL_ASSIGN[0..1] | Handwheel axis assignment | X, A | Default axis for handwheels 1, 2 |
| MD20150 $MC_GCODE_DEFAULT_VALUES[8] | G-code group 8 default | 1 (DRF on) | DRF on at channel reset |
| MD31090 $MA_JOG_INCR_WEIGHT[X] | Increment weighting X | 0.001 mm | 0.001 mm per pulse (fine) |
| SD41010 $SN_JOG_SET_SPEED | Dry-run feedrate | 0 | Not used for DRF |
| SD41600 $SC_HANDWHEEL_SEGMENT | Channel segment select | 1 | Active segment in current channel |
| SD41610 $SC_HANDWHEEL_STOP | Stop at block end | 0 | 0 = pulses across block boundaries |
| MD20154 $MC_GCODE_RESET_VALUES[8] | G-code group 8 reset value | 0 | 0 = DRF cleared at reset |
PLC Interface for Handwheel Selection
The PLC must set the per-axis handwheel assignment bits for the X-axis slot before M86 is processed. A minimal PLC snippet in Structured Text (S7-1500 / SINUMERIK PLC) is:
// SINUMERIK PLC - activate handwheel 1 for X axis when DRF request
IF "DB-Trigger".DRF_Request_X THEN
"DB31_X".DBX30.0 := TRUE; // Handwheel 1 -> X axis
"DB31_X".DBX30.1 := FALSE; // Handwheel 2 -> not X
ELSE
"DB31_X".DBX30.0 := FALSE;
"DB31_X".DBX30.1 := FALSE;
END_IF;
// Optional: route handwheel 2 to A axis for weld start alignment
"DB31_A".DBX30.0 := FALSE;
"DB31_A".DBX30.1 := TRUE; // Handwheel 2 -> A axis
On a SINUMERIK 840D sl the PLC slot for axis 1 (X) is DB31, axis 2 (Y) is DB32, axis 3 (Z) is DB33, and axis 4 (A) is DB34. Confirm the slot assignments with the machine's Axis Configuration view in the HMI before writing to the DBs. The handwheel assignment bits in DBX30.0 / DBX30.1 are edge-sensitive in some firmware versions: a transition from 0 to 1 selects the handwheel for that axis, and a transition back to 0 deselects it.
Operator HMI Behavior
Once M86 has been processed, the HMI displays the DRF offset in the position window for the X-axis. The HMI fields to watch are:
| HMI Field | Value Before DRF | Value After DRF Pulses |
|---|---|---|
| X (command position) | 0.000 | 0.000 (programmed path unchanged) |
| X (actual position) | 0.000 | 0.012 (handwheel offset applied) |
| X (DRF offset, D suffix) | 0.000 | 0.012 |
| A (command position) | 0.0 | 360.0 (A rotated per program) |
Operators on the EBW machine typically use the DRF offset value as the seam-tracking feedback. If the offset drifts beyond, for example, 1.0 mm in either direction it usually means the seam is off-center on the workpiece and the operator should pause the weld with M0 to re-check fixture position.
Verification Procedure
After the configuration has been applied, run the following verification to confirm the in-program handwheel assignment is working:
- Static test (no A motion): Run the part program up to the M86 block. The HMI should show the DRF active indicator (a small handwheel icon next to the X-axis in the position window). Rotate the handwheel 10 pulses in the positive direction. The X actual position should change by 10 x increment (0.01 mm if fine segment is active, 0.10 mm if 10x is active). Rotate 10 pulses in the negative direction; the position should return to the original value within one encoder count of noise.
- Dynamic test (with A motion): Start the A-axis rotation block. The A-axis should spin at the programmed feedrate. Rotate the handwheel 5 pulses in either direction; the X position should follow the handwheel offset while A continues to spin. Verify with a trace or a remote viewer that the A position is monotonic while the X position has the expected step pattern.
-
Reset test: Press RESET on the operator panel. The DRF offset on X should clear (or persist, depending on MD20154). If the offset is supposed to persist (so the operator does not have to re-zero the seam at every reset), set
MD20154 $MC_GCODE_RESET_VALUES[8] = 1. -
Alarm test: Pull the handwheel cable while the program is running. The NC should not drop a 21611 / 21612 alarm (handwheel monitoring). If it does, the handwheel watchdog time in
MD11353 $MN_HANDWHEEL_MONITOR_TIMEis set too short. Increase to 1.0 s (default is typically 0.5 s) and retest.
Troubleshooting Matrix
| Symptom | Likely Cause | Corrective Action |
|---|---|---|
| Handwheel does not move X in JOG | MD11352 $MA_HANDWHEEL_ASSIGN[X] = 0, or PLC DBX30.0 not set | Set MD11352 to 1, force DB31 DBX30.0 in the PLC, retry |
| JOG works, DRF in AUTOMATIC does not | M86 not processed, or G-code group 8 default = 0 | Confirm M86 is on its own line, check MD20150[8] = 1 |
| DRF offset is always zero | Handwheel 1 not assigned to X in the active channel | Check $AC_HANDWHEEL_SEGMENT[X] in the HMI diagnostics |
| X oscillates instead of stepping | Handwheel increment too small (noise threshold) | Switch to 10x (H89=10), or increase MD31090 to 0.01 mm |
| Alarm 21611 "Handwheel 1 defective" | Encoder signal lost or shield not grounded | Check IHN 030 wiring, verify shield ground at one end only |
| Alarm 16770 "Channel %1 block %2 DRF not possible" | DRF requested on an axis that is a slave or in follow-up mode | Decouple the axis (e.g., remove the coupling before M86) |
| DRF offset accumulates, never clears | MD20154 $MC_GCODE_RESET_VALUES[8] = 1 | Set to 0 if a clean reset is required |
| Operator can steer X in JOG but not while A is moving | Handwheel assignment PLC bits cleared during motion | Hold DBX30.0 = 1 with the PLC throughout the weld cycle |
Safety Considerations
Additional checks for production deployment:
- Verify that handwheel override (DRF) cannot drive the X-axis past the part envelope by testing with an out-of-range handwheel input. The position limit should alarm and clamp, not cause the beam to crash.
- Confirm the X-axis drive enable is removed within the safety-rated output time when the handwheel is unplugged mid-weld. Use the SINUMERIK safety-integrated (SPL) interface for the axis enable, not a standard PLC output.
- Document the H88 / H89 / M86 sequence in the operator's procedure so the operator cannot accidentally activate a stale handwheel assignment from a different program.
- Add an HMI confirmation prompt that displays the active DRF axis and segment value at the start of every weld cycle.
Alternative Approaches
If DRF is not available on the machine (older firmware, or DRF disabled by configuration), the same operator-in-the-loop seam-tracking effect can be obtained by:
-
Handwheel as encoder on a virtual axis: Define a virtual axis that is driven by the handwheel encoder, and gear the X-axis to it with a 1:1 ratio using the CODESYS / PLCopen
MC_GearInfunction block. The gear ratio is set to 1.0, the master is the handwheel-driven virtual axis, and the slave is X. Activate the gear block from the PLC when M86 is recognized, and deactivate it at M87. This requires a SINUMERIK 840D sl with the integrated PLC and a free axis slot for the virtual axis. See the SINUMERIK 840D sl Functions Manual - Axes and Spindles for the virtual axis configuration. - Override of programmed feedrate with handwheel: Use the rapid-traverse override (G0) handwheel or the feedrate override handwheel if the seam-tracking motion is small enough to be expressed as a feedrate variation. This is more limited than DRF but requires no special machine data.
- Program stop with operator re-zero: Use M0 to halt the part program between A-axis revolutions and let the operator steer X with the handwheel in JOG, then resume with NC START. This is the lowest-tech approach and is acceptable for slow welds with forgiving tolerance.
Field-Commissioning Notes
When commissioning a Probeam-style EBW cell with the H88 / H89 / M86 sequence, plan the following:
- Verify on the HMI diagnostics page that the handwheel encoder pulses are arriving at the NC kernel. The Handwheel diagnostic field shows the live pulse count for each handwheel. If the count is zero while turning the wheel, the encoder is not electrically connected.
- Program a small test part program that does not include the A-axis rotation. Use M86 to enable DRF, handwheel-steer X by 1.0 mm in each direction, then end the program. Confirm the X position returns to zero at reset.
- Add the real part program and run a dry weld (beam current off, vacuum on) to confirm the handwheel steering works while A is rotating. The expected motion is: A monotonic increase, X step pattern matching the handwheel pulses.
- Move to a real weld with a sacrificial part. The first production weld should be done with the operator on a separate, shielded E-Stop pendant so the cell can be halted within 50 ms if the handwheel steering is unstable.
- Once stable, document the H88 / H89 / M86 sequence in the machine's standard operating procedure and add it to the part-program template so all future weld programs inherit the handwheel assignment by default.
FAQ
What is DRF on a SINUMERIK 840D sl and what does M86 do?
DRF (Differential Resolver Function / Handwheel Offset) adds a handwheel-driven incremental offset to the programmed position of an axis in AUTOMATIC mode. On Probeam EBW machines the M-code M86 is the machine-specific command that activates DRF and routes the handwheel encoder pulses to the X-axis; the equivalent standard Siemens approach is to write $AC_HANDWHEEL_SEGMENT[X] = 1 in the part program.
Why are H88 and H89 used for the handwheel increment on a Probeam 840D sl?
H88 and H89 are Global User Data (GUD) variables defined by the Probeam machine builder. H88 sets the fine handwheel segment (value 1 = 0.001 mm per pulse) and H89 sets the coarse segment (value 10 = 0.01 mm per pulse). The values are the segment numbers; the actual displacement per pulse is governed by machine data MD31090 $MA_JOG_INCR_WEIGHT.
Can I take an axis out of CNC control and assign it to the handwheel while a part program is running?
No. The axis remains a programmed CNC axis. The DRF function superimposes an additive offset on the programmed command position; the handwheel pulses do not replace the programmed motion, they add to it. This is the only correct way to do real-time operator steering on a SINUMERIK 840D sl.
Why does my handwheel work in JOG but not in the part program after M86?
Three common reasons: (1) the PLC interface bit DB31 DBX30.0 (handwheel 1 -> X axis) is being reset by the PLC at the start of AUTOMATIC mode, (2) MD20150 $MC_GCODE_DEFAULT_VALUES[8] is set to 0 so DRF clears at every channel reset, or (3) the handwheel segment 1 / 10 values in H88 / H89 are overwritten by an HMI softkey. Verify the DBX30.0 bit, the MD20150 default, and the HMI focus on the channel.
How do I clear the DRF offset at the end of the weld?
Program M87 (machine-specific deactivation) at the end of the weld, or end the part program with M30 which clears the DRF offset at channel reset (provided MD20154 $MC_GCODE_RESET_VALUES[8] is set to 0). If the offset must persist across resets, set MD20154 to 1 and use a dedicated M-code or HMI softkey to clear it explicitly.
What is the safety behavior if the handwheel is unplugged mid-weld?
Does this work on SINUMERIK ONE or 840D sl with the latest firmware?
Yes. The DRF function, machine data MD31090, MD20150, MD20154, and the PLC interface DB31, ... DBX30.0/30.1 are unchanged in the SINUMERIK ONE and current 840D sl firmware (V6.x and higher). The H88 / H89 / M86 names are Probeam-specific; on a generic 840D sl use the equivalent GUD or $AC_HANDWHEEL_SEGMENT syntax and a standard M-code defined by your machine builder.