Problem Overview: M19 Contour Monitoring on SINUMERIK 802D
Spindle orientation via the M19 M-function is a standard capability of the SINUMERIK 802D powerline and 802D sl controls. When the operator commands M19 (for example, from an MDA or part-program block in preparation for a tool change), the controller is expected to decelerate the spindle from its current speed, switch the spindle drive into positioning (axis) mode, and rotate the spindle to a programmable angular position referenced to the spindle encoder. On a correctly configured machine, the spindle holds at that angle with the drive in closed-loop position control.
On retrofit and field-commissioned systems, M19 frequently fails with a Contour Monitoring alarm (typically alarm 25050 / "Contour monitoring" or 25080 "Positioning monitoring") during the orientation move. The drive enters axis mode, oscillates back and forth, then either faults out or settles off-angle and triggers the contour window violation. This article documents the root causes, parameter set, and PLC interface that must be in place for M19 to succeed on 802D, with particular focus on:
- Analog spindle drives with external incremental encoders
- 1:N mechanical ratios (e.g., motor:spindle = 1:10)
- Induction motor spindles (no built-in motor encoder feedback to the drive)
Root Cause Analysis: Why M19 Triggers Contour Monitoring
The contour monitoring alarm during M19 is a position-following-error fault, not a hardware failure. The controller compares the actual spindle position (derived from the spindle-mounted encoder) against the position setpoint computed from MD 43240 $SA_M19_SPOS. When the deviation between setpoint and actual exceeds the tolerance defined by the contour-monitoring machine data for an interval longer than the delay time, alarm 25050 or 25080 is raised and the drive is stopped.
The most common root causes observed on 802D systems are:
| Root Cause | Symptom | Detection |
|---|---|---|
| Contour tolerance window too small for the open-loop gain | Alarm raised at end of move, spindle close to but not exactly on target | Service display axis AA_FOLLOW_ERR or SERVO trace shows overshoot/undershoot |
| Kv factor (MD 32200 $MA_POSCTRL_GAIN) too low for the load inertia | Slow convergence, large following error during the move | Trace following error at constant velocity |
| Acceleration (MD 32300 $MA_MAX_AX_ACCEL) too aggressive | Overshoot, oscillation around target | Trace setpoint vs actual position |
| Encoder polarity inverted (MD 32110 $MA_ENC_FEEDBACK_POL = -1 vs +1) | Spindle rotates in wrong direction, drives into mechanical stop, then faults | Rotate spindle manually in JOG, observe actual position sign |
| Load gear ratio not entered (MD 31050 / 31060, MD 31070 / 31080 for spindle load gear) | Spindle appears to rotate at wrong speed, large following error scales | Compare motor revolutions to spindle revolutions in service display |
| Spindle PLC enable missing (V2500 1002.3 / DB3x "Spindle on" not set during M19) | Drive runs open-loop or oscillates without torque authority | PLC status page, axis diagnostics > control signals |
| Encoder mounted to wrong shaft (motor vs spindle side of gear) | Position reads correctly in JOG, M19 still faults | Mark spindle, rotate 1 rev, verify encoder count matches gear ratio |
| Wrong encoder selected in MD 30220 $MA_ENC_MODULE_NR / MD 30230 $MA_ENC_INPUT_NR | No encoder feedback in service display | Service display axis shows "no encoder" or stuck count |
On the 802D specifically, two failure modes dominate field reports:
- Oscillation around the target angle. The contour window is too tight relative to the achievable steady-state accuracy. Increasing the window allows the move to complete; the proper fix is then to tune Kv and acceleration.
- Drive never reaches axis mode. The PLC does not pulse the spindle-on (V2500 1002.3) signal during the positioning phase, so the drive falls back into speed-controlled mode and the position controller cannot close the loop.
Preconditions: Hardware and Option Checks
Before changing any parameters, verify the following preconditions. Each missing item will cause M19 to fault independent of the parameter set.
Option Activation
The M19 spindle positioning function is an option (function bit) that must be enabled in the control. On 802D powerline, confirm the option in the commissioning menu under Start-up > Options and ensure that the option license is loaded. The Siemens SINUMERIK 802D sl Function Manual documents SPOS, SPOSA, and M19 as the supported spindle-positioning commands.
Encoder Mounting and Cabling
The external spindle encoder must be:
- Mounted directly to the spindle (or to a gear stage that turns 1:1 with the spindle) when used as the position reference for M19. Mounting to the motor shaft is acceptable for speed feedback but causes the position to drift by the gear ratio and backlash.
- Wired to the encoder input on the SIMODRIVE 611U universal module or the SINAMICS S120 SME/SMI module that is assigned to the spindle drive.
- Assigned to the spindle axis via MD 30220 $MA_ENC_MODULE_NR and MD 30230 $MA_ENC_INPUT_NR (or the spindle-equivalent MDs on 802D).
Mechanical Ratio Entry
For a 1:10 motor-to-spindle ratio (the source machine case), enter:
- MD 31050 $MA_DRIVE_AX_RATIO_DENOM (load gear denominator) = 10
- MD 31060 $MA_DRIVE_AX_RATIO_NUMERA (load gear numerator) = 1
Or, for the spindle-specific load gear fields on 802D, the equivalent spindle gear ratio machine data. The controller uses this ratio to convert motor revolutions to spindle revolutions when computing the M19 target position.
Encoder Polarity
MD 32110 $MA_ENC_FEEDBACK_POL must be set such that positive motor rotation produces positive actual position. Verify by jogging the spindle in M3 at low speed (e.g., S50) and watching the service display actual position. If the position decreases while the spindle turns CW, invert the polarity sign.
Parameter Setup for M19 Spindle Positioning
The following machine data is the minimum set required to bring M19 into service on a SINUMERIK 802D with an analog-controlled spindle drive and external encoder. All MDs are entered under Start-up > Machine Data > Axis MD and become active after NCK reset.
| MD Number | Name | Typical Value | Purpose |
|---|---|---|---|
| 43240 $SA_M19_SPOS | Spindle position for M19 | 0 to 359.9 (degrees) | Target angular position commanded by M19 |
| 32200 $MA_POSCTRL_GAIN | Position loop Kv factor | 0.5 to 2.0 (1/s) | Open-loop gain in positioning mode. Raise to reduce following error; lower if oscillating. |
| 32300 $MA_MAX_AX_ACCEL | Maximum axis acceleration | 5 to 50 (m/s² or rev/s² depending on axis type) | Limits acceleration during the orient move |
| 36200 $MA_AX_VELO_LIMIT | Axis velocity limit | 500 to 36000 (deg/min or rev/min) | Velocity clamp during orientation |
| 36400 $MA_CONTOUR_TOL | Contour tolerance | 1.0 to 20.0 (mm or deg) | Contour-monitoring window. Set to a value larger than the steady-state following error. |
| 36620 $MA_POS_TOL | Position tolerance (coarse) | 1.0 to 10.0 (mm or deg) | "In position" window reported to PLC |
| 36610 $MA_POS_TOL_FINE | Fine position tolerance | 0.5 to 5.0 (mm or deg) | Fine "in position" window for NCK-internal sequencing |
| 36010 $MA_STOP_LIMIT_FINE | Fine stop limit | 0.5 to 5.0 | Defines the position threshold below which the NCK considers the spindle "at standstill" |
| 32110 $MA_ENC_FEEDBACK_POL | Encoder feedback polarity | +1 or -1 | Sign of actual position vs rotation |
| 31050 / 31060 | Load gear ratio denominator / numerator | 10 / 1 (for 1:10) | Mechanical ratio motor to spindle |
PLC Interface and Signal Sequence for M19
The 802D spindle PLC interface is mapped to V2500 (read) and V3000 (write) on the 802D powerline, or to the equivalent DB3x range on 802D sl. The critical signals during M19 are:
| Address (802D powerline convention) | Direction | Signal | Action During M19 |
|---|---|---|---|
| V2500 1000.x | NCK → PLC | Spindle control bits from NCK | Includes setpoint direction, M19 request, gear stage |
| V2500 1002.3 | NCK → PLC | Spindle ON (setpoint side) | NC sets this bit while commanding M3/M4/M5/M19. PLC must forward to drive enable. |
| V3000 1002.3 | PLC → NCK | Spindle ON (acknowledge) | PLC confirms that drive has been enabled |
| V3000 1000.x | PLC → NCK | Spindle feedback bits | Includes actual direction, in-position status |
| V2500 1000.4 (or equivalent M19 bit) | NCK → PLC | M19 active | Indicates the spindle has been commanded to orient. PLC may need to suppress a gear-change request or inhibit an external feed-hold. |
The most common PLC mistake on retrofit 802D systems is failing to keep V2500 1002.3 set during the entire M19 sequence. M19 is a positioning command but it is still classified as a spindle function from the drive's point of view. If the PLC releases the drive enable when it sees the spindle decelerate, the drive never enters axis mode and the position controller cannot actuate the motor.
Verified good practice (per Siemens 802D sl PLC sample program):
- Pass through the V2500 1002.3 "spindle on" request to the drive enable output unconditionally during spindle modes including M19.
- Suppress any external spindle reset that would clear the drive enable while the axis is in motion.
- Evaluate the "M19 active" NCK output and route it to any tool-changer handshake so the changer does not advance until the spindle has settled at the programmed angle.
Step-by-Step Commissioning Procedure
Use the following procedure to bring M19 into service on an 802D with an analog spindle and external encoder. The procedure assumes the machine data from the previous section is loaded but not yet optimized.
- Reset the NCK and confirm option state. Power on, access Start-up > Options, verify the M19 option bit is set. If not, load the option file and re-verify.
-
Jog the spindle in M3 / M4 at low speed. Use MDA with
S100 M3and watch the spindle ramp up. Verify actual position moves in the correct direction in the service display (Diagnostics > Service Display > Axis). If direction is wrong, toggle MD 32110 polarity sign. - Set MD 43240 to a known target angle. For example, 90.0 degrees. This is the angle the spindle will move to on the next M19.
- Set a generous contour tolerance. Temporarily raise MD 36400 $MA_CONTOUR_TOL to a large value (e.g., 20 degrees) so that the first attempts do not trip the contour alarm while the loop is untuned.
-
Command M19 from MDA. Enter
M19on its own line in MDA. The spindle should decelerate, switch to axis mode, and rotate to 90 degrees. If contour monitoring is still raised, increase the tolerance further or check the encoder feedback in the service display. - Reduce the tolerance and tune the loop. Once M19 completes reliably with the wide tolerance, step MD 36400 down toward the steady-state following error observed in step 5. A typical target is 1.0 to 2.0 degrees for a 1:10 geared spindle with a reasonable encoder (1024 ppr or higher).
- Tune Kv and acceleration. Use the SERVO trace function to record setpoint and actual position during the orient move. Increase MD 32200 Kv if the following error during the move is large; decrease it if the spindle oscillates around the target. Adjust MD 32300 acceleration to settle within a few hundred milliseconds without overshoot.
- Verify M19 from a part program. Add an M19 call to a tool-change block in a test program. Run the program in single-block mode and confirm the spindle settles within the position-tolerance window before the next block executes.
Verification and Service-Display Diagnostics
After commissioning, use the service display to confirm that the M19 move completes cleanly and that the steady-state accuracy meets the tool-change requirement. The following checks should be performed and recorded.
| Verification Step | Expected Result | Pass Criterion |
|---|---|---|
| M19 from MDA at S0 (spindle already stopped) | Spindle rotates to MD 43240 angle and stops | No alarms; PLC in-position bit (V3000 1000.x) sets within 2 s |
| M19 from S1500 M3 (spindle running) | Spindle decelerates, orients, settles | No 25050 / 25080 alarms; final actual position within MD 36620 |
| Service display AA_FOLLOW_ERR during orient | Following error peak and decay | Peak within MD 36400 contour tolerance; decay time < 500 ms |
| Service display actual position after settle | Reads MD 43240 value | Deviation < MD 36610 fine tolerance |
| Tool-change block execution | Tool changer advances only after spindle settled | No mechanical interference; no alarm during tool change |
The Siemens SINUMERIK 802D sl Function Manual describes SPOS and SPOSA as block-synchronous spindle-positioning commands that the NCK executes in the interpolator. M19 is a higher-level M-function that the PLC passes through and that the NCK translates internally to an SPOS at the angle held in $SA_M19_SPOS. The functional behavior described in the Beckhoff TwinCAT CNC M19/POS reference matches: M19 must be combined with a position word (POS in TwinCAT, $SA_M19_SPOS on Siemens) and must be issued in a block that does not contain a competing M3/M4 spindle-speed command.
Troubleshooting Matrix
| Symptom | Likely Cause | First Action | Parameter / Signal |
|---|---|---|---|
| Contour monitoring 25050 immediately on M19 | No encoder feedback / wrong encoder assigned | Service display axis: verify actual position changes when spindle rotates | MD 30220 / 30230 |
| Spindle oscillates back and forth, then faults | Kv too high or polarity inverted | Reduce MD 32200 by 50%; check MD 32110 | MD 32200, MD 32110 |
| Spindle rotates to wrong angle (e.g., 180° off) | Encoder zero mark misaligned or polarity wrong | Reference encoder zero; check direction in JOG | MD 32110, encoder zero offset |
| Spindle rotates to correct angle but is off by gear ratio | Load gear ratio MDs not entered or wrong | Mark spindle, rotate motor 1 rev, count spindle revs | MD 31050 / 31060 |
| Drive never enables during M19 | PLC V2500 1002.3 not passed to drive enable | Force V3000 1002.3 in PLC, retry M19 | PLC program |
| Move completes in MDA but faults in part program | M19 in same block as M3/M4, or M19 reset by modal reset | Issue M5 before M19, ensure M19 is alone in its block | Part-program syntax |
| Alarm only on fast spindles, not on slow ones | Acceleration limit too low; contour window too tight | Increase MD 32300; widen MD 36400 | MD 32300, MD 36400 |
| Alarm at end of move, spindle on target | Fine stop tolerance tighter than achievable accuracy | Widen MD 36610 and MD 36620 | MD 36610, MD 36620 |
| M19 command rejected, no motion at all | M19 option not enabled | Check option bit; load option file | Option license |
Cross-Platform Note: M19 on Non-Siemens Controllers
The M19 spindle-orientation convention is broadly supported on Fanuc, Heidenhain, Siemens, and Beckhoff controls, but the parameter and signal locations differ significantly. On Beckhoff TwinCAT CNC, M19 is interpreted in conjunction with the POS word in the same NC block, as documented in the Beckhoff TF5200 programming manual. The Siemens approach separates the M-function (M19) from the position argument (held in $SA_M19_SPOS) and uses the PLC interface V2500/V3000 to handshake with the drive. When porting M19 logic between platforms, the engineer should treat the position source (spindle setting data on Siemens, POS argument on Beckhoff) and the spindle-on signal path as the two primary deltas, and re-verify the contour-monitoring window against the achievable steady-state accuracy of the new drive/encoder combination.
Safety and Commissioning Caveats
FAQ
Why does M19 give a contour monitoring alarm on my Siemens 802D?
The most common reason is that the contour-monitoring window (MD 36400 $MA_CONTOUR_TOL) is smaller than the steady-state following error of the spindle position loop. Increase MD 36400 to a value larger than the observed following error, then tune MD 32200 Kv and MD 32300 acceleration so the loop settles within the original production tolerance.
What parameter holds the M19 target angle on 802D?
MD 43240 $SA_M19_SPOS holds the target angular position. Enter a value between 0 and 359.9 degrees. The spindle will rotate to this absolute angle on the next M19 command. For part-program-controlled angles, use SPOS or SPOSA with a numeric argument instead of M19.
Which PLC signal enables the spindle drive during M19?
On 802D powerline, V2500 1002.3 (spindle setpoint ON) is the request from the NCK and V3000 1002.3 (spindle ON acknowledge) is the PLC confirmation back to the NCK. The PLC must keep the drive enabled for the entire M19 move; releasing the drive enable when the spindle decelerates will prevent the drive from entering axis mode.
Can M19 be used with an induction motor spindle and an external encoder on 802D?
Yes. M19 requires a position reference, which can come from the motor-mounted encoder (typical for SIMODRIVE 611U universal modules) or from an external encoder mounted to the spindle or a 1:1 stage. For a 1:10 motor-to-spindle ratio, set the load gear MDs (MD 31050 / MD 31060) so the controller can scale motor revolutions to spindle revolutions when computing the target position.
How do I tune the spindle position loop for M19?
Start with a low Kv (MD 32200 around 0.5 to 1.0) and a generous contour tolerance. Command M19, record the following error with the SERVO trace, raise Kv to reduce the following error, and lower it if the spindle oscillates. Adjust MD 32300 acceleration to settle within a few hundred milliseconds. Then tighten MD 36400, MD 36610, and MD 36620 to the production tolerance.