Overview of the 850 to 840D PLC Migration
Retrofitting a SINUMERIK 850 controller to a SINUMERIK 840D (or 840D sl) involves three parallel work streams: the drive package, the NCK (NC kernel) configuration, and the PLC program. The PLC stream is the most fragile because the original 850 was delivered with a STEP 5 application on an S5-130/150-class PLC, while the 840D executes a STEP 7 program on the integrated S7-300 PLC of the NCU (Numerical Control Unit). The PLC image, the data block structure, the I/O address assignment, and the function block numbering scheme are all different.
Field engineers performing this migration regularly encounter undocumented function blocks such as FB200, FB201, FB210, and similar high-numbered FBs that were appended by the machine builder (OEM) rather than by Siemens. These blocks are not present in the Siemens STEP 5 manual set. The most commonly cited block in retrofit discussions is FB200 with the symbolic name GREASE — a combined counter/timer block used to drive the central lubrication pump of the machine tool. Because the original documentation was rarely archived, the only reliable approach is to re-engineer the function from the machine's mechanical lubrication schedule and rebuild it cleanly in STEP 7.
SINUMERIK 850 vs 840D Architecture Differences
Understanding the platform delta is necessary before touching the PLC code. The SINUMERIK 850 was a predecessor control using an external S5 PLC for the machine interface. The SINUMERIK 840D integrates the PLC into the NCU module as an S7-300 compatible CPU (CPU 314, 315, or 317 depending on NCU variant). The relevant differences for the PLC migration engineer are:
| Subsystem | SINUMERIK 850 + S5 PLC | SINUMERIK 840D / 840D sl |
|---|---|---|
| PLC CPU | External S5-130W / S5-150U / S5-155U | Integrated S7-300 (in NCU 573.x, 710.x, 720.x, 730.x) |
| Programming language | STEP 5 (AWL, KOP, FUP) | STEP 7 (AWL, KOP, FUP, SCL, GRAPH) |
| PLC cycle | Standalone, typically 20–50 ms | Tied to IPO/positioning cycle; PLC runs at 840D PLC basic program priority |
| I/O bus | Proprietary or SINEC L1 | PROFIBUS DP / PROFINET on NCU |
| Function block library | OEM-specific, undocumented FBs common | Siemens basic program: FCs 0–39, FBs 1–31 reserved; OEM blocks start at FC100/FB100 |
| Data blocks for machine data | DB 1–255 typically free | DB 1–62 reserved by basic program; DB 1000+ free for OEM |
Reference: the SINUMERIK 840D sl machine configuring guide describes the integrated PLC architecture, the line filter / line reactor cabling, and the PROFIBUS topology used between the NCU, SIMODRIVE 611 modules, and the I/O stations. See the official manual at SINUMERIK 840D sl Machine Configuring Guide (MA1_0706_en.pdf).
Why FB200 Is Not in the Siemens STEP 5 Manuals
Siemens published the STEP 5 standard function block set (FB 1–FB 254) in the "STEP 5 Standard Function Blocks" manual. Blocks above the standard numbering or in the 200–255 range were almost always OEM-allocated. The convention used by German and Swiss machine builders in the late 1980s and early 1990s was to reserve:
- FB 200–209: Lubrication, hydraulic, coolant
- FB 210–219: Spindle gear stage, spindle orientation
- FB 220–229: Tool changer, magazine
- FB 230–239: Axis-specific OEM blocks
- FB 240+: Safety, operator panel, miscellaneous
Reverse-Engineering the Grease Function
The lubrication cycle on a CNC machine tool is a closed-loop sequence. The Grease block on an 850-class machine typically performs these tasks:
- Count a configurable number of axis movements, spindle hours, or distance travelled.
- On reaching the threshold, energise the grease pump output for a configurable pump-on time (typically 2–10 seconds).
- Monitor a pressure-switch input to confirm the pump actually delivered lubricant.
- Trigger an alarm if the pressure feedback is missing within a supervision window (typically 30–60 seconds).
- Reset the counter and start the next interval.
The 850 S5 implementation normally used an S5 timer as the cycle clock, an S5 counter (or DW in a data block) as the stroke counter, and a single output bit to drive the pump contactor. The S5 version can be characterised from the wiring diagram without ever opening the FB200 source code.
Capturing the I/O Assignment Before Conversion
Before deleting the S5 program, the field engineer must capture the following from the existing installation:
| Signal | Direction | Typical S5 address | 840D mapping |
|---|---|---|---|
| Pump contactor output | Output | Q 32.0 / Q 64.0 | Q area of NCU or distributed I/O on PROFIBUS |
| Pressure switch feedback | Input | I 33.4 / I 65.4 | I area of NCU or distributed I/O |
| Lube-OK lamp | Output | Q 33.5 | HMI tag, NCK-PLC interface bit |
| Lube fault lamp / alarm | Output | Q 33.6 | DB2 / NCK alarm 600xxx via FC10 / alarm logging |
| Manual lube request (operator panel) | Input | I 32.7 | MCP input or HMI softkey tag |
Document these signals in a signal-list spreadsheet. This list becomes the I/O interface specification for the new 840D PLC program.
S5 to S7 Conversion Strategy for OEM Blocks
The Siemens "S5 to S7 Converter" (formerly shipped with STEP 7 as a separate tool, now part of the TIA Portal migration toolset) is of limited use for OEM blocks because it only translates syntax, not intent. A typical conversion result for FB200 is one of three outcomes:
-
Clean conversion — the block was written in pure STEP 5 standard syntax and converts to compilable S7. The block is then renumbered to a free FB/FC number in the 840D PLC (e.g.
FB200→FB1000). -
Conversion with errors — direct references to
DX/DYextended data blocks, or to absolute timer/counter words that no longer exist on the S7-300, fail. The converted block must be hand-edited in STEP 7. -
Conversion failure — the block uses S5 functions that have no S7 equivalent (e.g.
DO DWfor a multiply, or absolute direct I/O accesses). The block must be re-written from scratch.
For FB200 Grease, expect outcome 2 or 3. The re-write is short (one FB plus one instance DB) and is preferred over a broken conversion.
Reimplementing the Lube Frequency Logic in STEP 7
The new Grease function should be implemented as a reusable FB with an instance DB and with all timing parameters stored in a machine data DB. The recommended structure on a SINUMERIK 840D is:
- FB1000 (GREASE) — function block containing the cycle counter, pump timer, pressure supervision, and fault logic.
- DB1000 (GREASE_IDB) — instance DB, holding the static counters and edge flags.
- DB200 (MACHINE_PARAM) — machine data block holding the configurable intervals and pump-on time, accessible from the HMI for service changes.
This matches the field-tested practice of putting all machine-specific numeric values into a single parameter DB so the maintenance crew can adjust them from the HMI without a programming device.
Block Interface (STEP 7 STL)
FUNCTION_BLOCK FB1000
VAR_INPUT
i_CountPulse : BOOL; // 1 pulse per spindle hour, or per axis travel increment
i_PressureOK : BOOL; // 1 = pressure switch indicates lube delivered
i_ManualReq : BOOL; // 1 = operator manual lube request
i_Reset : BOOL; // 1 = reset all counters and alarms
END_VAR
VAR_OUTPUT
o_PumpOn : BOOL; // 1 = energise grease pump contactor
o_LubeOK : BOOL; // 1 = lubrication cycle complete and healthy
o_Fault : BOOL; // 1 = pressure not confirmed within window
END_VAR
VAR
s_CountValue : INT; // current stroke counter (0 .. s_LimitValue)
s_TimerPump : SFB4, SFB5 or IEC_TIMER; // pump-on timer
s_TimerSupv : IEC_TIMER; // pressure supervision window
s_PumpOn : BOOL; // pump latched output
s_PressureSeen : BOOL; // edge flag for pressure-switch feedback
END_VAR
Internally the block performs a level-triggered count: every i_CountPulse increments s_CountValue until it reaches the configurable limit DB200.DBW0 (default 100), at which point the pump is energised for the configurable time DB200.DBW2 (default 5 seconds). The pressure switch must be seen within DB200.DBW4 (default 30 seconds) or a fault is raised.
Sample Count-and-Pump Sequence (STEP 7 STL)
A i_CountPulse
FP M 100.0 // edge flag for count pulse
JCN NO_CNT
L s_CountValue
L DB200.DBW0 // configurable cycle count limit
>=I
JC PUMP_REQ // limit reached, trigger pump
L s_CountValue
+ 1
T s_CountValue
NO_CNT: NOP 0
PUMP_REQ:
L s_CountValue
L 0
==I
JCN PUMP_RUN // only trigger when counter just rolled over
SET
S s_PumpOn // latch pump request
S o_PumpOn
L 0
T s_CountValue // reset counter for next cycle
PUMP_RUN: NOP 0
Pressure Supervision
A o_PumpOn
AN s_TimerPump.Q // pump-on time elapsed
= s_PumpOn // self-resetting via timer
A o_PumpOn
L S5T#30s // supervision window from DB200.DBW4
SD s_TimerSupv
NOP 0
A i_PressureOK
FP s_PressureSeen
JCN CHK_FLT
R o_Fault // pressure confirmed, clear fault
SET
= o_LubeOK
R s_TimerSupv
CHK_FLT:
A s_TimerSupv // supervision window expired
AN i_PressureOK
S o_Fault // no pressure → alarm
R o_LubeOK
840D PLC Program Structure: OB100, OB1, FC/FB Allocation
The 840D PLC is delivered with a Siemens basic program that occupies a fixed set of blocks. OEM code must be added around this reserved area.
| Block | Reserved by | OEM action |
|---|---|---|
| OB 1 | Basic program (cyclic) | Append OEM call at end of OB1 |
| OB 100 | Basic program (warm restart) | Append OEM initialisation in OB100 |
| OB 40 / OB 82 / OB 86 | Basic program (errors) | Do not modify |
| FC 0–FC 39 / FB 1–FB 31 | Siemens basic program | Do not allocate in this range |
| DB 1–DB 62 | Siemens basic program | Do not allocate in this range |
| FC 100+ / FB 100+ | Free for OEM | Allocate FB1000 (Grease) here |
| DB 1000+ | Free for OEM | Allocate DB1000 (instance), DB200 (machine params) |
Call the Grease FB from OB1 after the basic program:
// In OB1, append at the end of network 100+:
CALL FB1000, DB1000
i_CountPulse := M 200.0 // pulse generated by spindle-hour counter
i_PressureOK := I 33.4 // 1 = pressure switch healthy
i_ManualReq := I 32.7 // operator manual lube pushbutton
i_Reset := M 201.0 // reset from HMI or NC reset
o_PumpOn := Q 32.0 // pump contactor output
o_LubeOK := M 202.0 // lube healthy → HMI status
o_Fault := M 202.1 // lube fault → HMI alarm
Parameter Mapping for Maintainable Grease Control
Storing the cycle parameters in a single data block allows the maintenance crew to adjust them from the HMI without the STEP 7 programming software. The recommended layout for DB200 (LUBE_PARAM) is:
| Address | Symbol | Type | Default | Description |
|---|---|---|---|---|
| DB200.DBW0 | LUBE_CYCLE_COUNT | INT | 100 | Number of count pulses per lube cycle |
| DB200.DBW2 | LUBE_PUMP_TIME_S | INT | 5 | Pump-on time in seconds |
| DB200.DBW4 | LUBE_PRESS_WINDOW_S | INT | 30 | Pressure feedback window in seconds |
| DB200.DBW6 | LUBE_PULSE_DIVIDER | INT | 1 | Count every Nth pulse (debounce) |
| DB200.DBB8 | LUBE_MODE | BYTE | 0 | 0 = count mode, 1 = time mode, 2 = distance mode |
| DB200.DBX9.0 | LUBE_ENABLED | BOOL | 1 | Master enable for lube function |
| DB200.DBW10 | LUBE_TOTAL_CYCLES | INT | 0 | Lifetime cycle counter (read-only display) |
Expose DB200 to the HMI by configuring the relevant tags in WinCC Flexible / TIA Portal HMI as data record read/write with the standard PLC DB area pointer. The maintenance screen can then be a simple three-field input mask for cycle count, pump time, and pressure window.
Step-by-Step Implementation Procedure
- Capture the existing S5 program from the 850 PLC using the PG (programming device) and STEP 5 software. Save the entire S5 program archive to a protected folder, including the FB200 source, the DB list, and the I/O assignment list.
- Document the machine's lubrication specification: pump model, lubricant grade, cycle count, pump-on time, pressure switch type and threshold. This is normally on the machine nameplate or in the maintenance manual from the OEM.
- Build the signal list in a spreadsheet: every input and output of the S5 FB200, mapped to the equivalent 840D PLC address. Highlight any signals that no longer exist on the new machine (e.g. a gear-stage signal that is now in the NCK).
- Create the S7 program skeleton in STEP 7 (or TIA Portal). Allocate FB1000, DB1000, DB200. Leave the Siemens basic program blocks untouched.
- Code the new Grease FB following the structure in the previous section. Use IEC timers and counters for portability.
- Add the FB call in OB1 at the end of the cycle, after the basic program has updated the NCK-PLC interface (DB2, DB3x).
- Add the parameter initialisation in OB100 with the default values from the lubrication specification. Use an initialisation FB or direct loads in OB100.
- Compile and download the project to the 840D NCU. Use the STEP 7 "Download to target system" function. Monitor the PLC online to confirm the cycle is running.
-
Wire-check the I/O: force
o_PumpOnfrom the STEP 7 variable table and confirm the pump contactor pulls in and the pressure switch feedback arrives within the supervision window. - Expose the parameters to the HMI by configuring DB200 tags in the HMI project. Verify that the maintenance screen can read and write each parameter.
- Document the new PLC program in a one-page operator card that lists the new FB/FC numbers, the parameter DB, and the alarm tag numbers. Hand a printed copy to the maintenance supervisor.
Commissioning and Verification
Verification on the 840D follows the standard Siemens commissioning checklist for PLC program changes. Use the STEP 7 / TIA Portal online monitoring functions and the HMI diagnostic screens.
| Test | Procedure | Expected result |
|---|---|---|
| Pump energise | Force o_PumpOn = 1 from the variable table for 6 seconds |
Contactor pulls in within 200 ms, releases after timer |
| Count cycle | Toggle i_CountPulse 100 times from a test flag |
Pump energises once after the 100th pulse, counter resets to 0 |
| Pressure feedback | Force i_PressureOK = 1 2 s after pump starts |
o_Fault = 0, o_LubeOK = 1 for 1 cycle, then cleared by next cycle |
| Pressure supervision | Force i_PressureOK = 0 throughout a pump cycle |
o_Fault = 1 after 30 s, HMI shows lube fault alarm |
| Manual request | Pulse i_ManualReq from the HMI softkey |
Pump runs one cycle, then waits for the next interval |
| Parameter write from HMI | Change DB200.DBW0 from 100 to 50 in the HMI |
Next pump cycle fires at 50 count pulses, not 100 |
| Cold restart | Power off the NCU and restart | OB100 initialises DB200 to defaults, pump waits for first interval |
Troubleshooting Matrix
| Symptom | Likely cause | Remedy |
|---|---|---|
| Pump never runs | Count pulse never arrives; counter is initialised but never incremented | Check the spindle-hour-counter flag, the axis-travel-pulse generator, and the count-pulse divider in DB200.DBW6 |
| Pump runs continuously | Pump timer is not resetting the output; pump-on time is too long for the configured timer | Check the SFB timer type, the S5T# format, and the pump-on time in DB200.DBW2 |
| Lube fault alarm every cycle | Pressure switch is wired normally-closed but code expects normally-open, or the pressure-switch threshold is set too high for the pump output | Invert the i_PressureOK input, or check the mechanical pressure setting on the switch |
| Pump runs once, then never again | Counter is reset to 0 but the count pulse source is latched on | Insert an edge evaluation (FP) on the count pulse input; check the count-pulse generator for stuck-high state |
| OB1 cycle time too long after adding FB1000 | The Grease FB uses a slow timer base or is calling additional nested FBs | Check the PLC scan time in the basic program diagnostics; switch IEC timers to the faster SFB4 / SFB5 base; flatten the call structure |
| HMI parameter write has no effect | DB200 is read-only in the HMI tag list, or the HMI is configured to a different DB number | Re-export the HMI tags from the STEP 7 symbol table, confirm the HMI area pointer is configured as DB (not as MK / PK) |
| Original S5 FB200 still shows in the STEP 5 archive but not in the S7 project | Conversion was run on a subset of blocks | Run the S5 → S7 converter on the entire S5 program, not on individual FBs, to capture cross-references |
Safety and EMC Considerations During the Retrofit
The SINUMERIK 840D sl machine configuring guide (linked above) covers the EMC-correct routing of the power cable between the line filter and the line reactor, and the minimum cross-section of 850 mm² unshielded for certain power segments. The PLC wiring of the lubrication pump is not safety-relevant if the pump is a non-safety auxiliary, but the pressure-switch feedback can be wired to a safety input module (F-CPU module) on the 840D sl NCU if the OEM rated the lube system as safety-related. Confirm the machine's safety category (typically Cat 3 / PL d) with the OEM before assuming the lube fault can be a non-safety alarm only.
Frequently Asked Questions
Does Siemens document FB200 for the SINUMERIK 850?
No. FB200 is an OEM-added block. The Siemens STEP 5 standard function block set stops well before FB 200 on customer-specific blocks. Documentation must come from the original machine builder; if unavailable, the block must be reverse-engineered from the I/O list and rebuilt in STEP 7.
Should I use the S5 to S7 converter on FB200?
Only as a last resort. The converter translates syntax but not intent, and OEM blocks often use absolute timer/counter addresses that have no S7 equivalent. Plan to re-write the block. The new code will be smaller, easier to maintain, and parameterised in a data block.
What FB/FC number range is free for OEM code on a SINUMERIK 840D?
FC 100+ and FB 100+ are free. The Siemens basic program occupies FC 0–39, FB 1–31, and DB 1–62. A common convention is to place the new Grease function at FB 1000 and its instance DB at DB 1000, with the parameter DB at DB 200 to mimic the 850 era.
How do I expose the lube parameters to the HMI for the maintenance crew?
Store all cycle counts, pump times, and pressure windows in a single data block (DB200) and expose that DB to the HMI as a data record read/write area. The operator then has a simple input mask and does not need STEP 7 access to change parameters.
Is the lubrication function safety-relevant on a SINUMERIK 840D retrofit?
It depends on the machine's original safety category. The 850 may have wired the lube fault to a hard-wired E-stop. Carry that wiring forward into the 840D retrofit through an F-CPU module if the original design rated the lube system as safety-related. A non-safety PLC alarm alone is not a substitute for hard-wired protection.