Problem Statement: Conditional PROFINET Activation on S7-1200
A flexible S7-1200 program often needs to support more than one runtime topology. A typical requirement is a base configuration that runs on every machine and an extended configuration that adds I/O, drives, or third-party PROFINET devices only when the customer purchases the extra option. The extended hardware (for example a SINAMICS G120 frequency drive) is wired in at the cabinet but is not always powered up or connected.
When a configured PROFINET IO device is unreachable at start-up, the CPU enters a station failure state: the SF (red) LED blinks, the diagnostic interrupt is raised, and any cyclic I/O from that device is set to substitute values (0 for digital, 0 for analog). This is the root of the original problem: the PLC cannot be put into RUN when an optional PROFINET device is missing or powered off.
The legacy S7-300 environment solved this with the D_ACT_DP / DEACT_DPS blocks. The same approach is available on the S7-1200 using the D_ACT_DP instruction in TIA Portal, as confirmed by Siemens Support Entry ID 109741593: "With the D_ACT_DP instruction, you can disable and enable configured PROFINET IO devices in a targeted manner."
How PROFINET Reacts to a Missing Device
PROFINET IO communication is supervised by the IO controller (the S7-1200 CPU) using AR (Application Relationship) and CR (Communication Relationship) state machines defined in IEC 61784-2. Once the controller has accepted a device into the configured slot, it expects an AR to come up within the configured Device Replacement Timeout (TIA Portal default usually 600 ms, configurable up to several seconds). If the AR does not appear or disappears, the device transitions to a station-fault state and the CPU raises diagnostic interrupts.
This is why simply leaving a device configured but disconnected causes a red BF/MF LED pattern and propagates a station fault into the diagnostic buffer. D_ACT_DP deliberately withdraws the configured slot from active I/O exchange, putting the relationship into a "deactivated" state where the controller no longer expects the AR to come up.
Solution Overview: D_ACT_DP
D_ACT_DP is a standardized block used uniformly across S7-300, S7-400, S7-1200, and S7-1500. The CPU keeps the device configuration in its project but deactivates the cyclic data exchange at runtime.
- Configured devices stay in the HW configuration and the diagnostic tree.
- Calling
D_ACT_DPwithMODE = 2deactivates the device; no station fault is raised for it. - Calling
D_ACT_DPwithMODE = 1re-activates the device; the AR is re-established and IO exchange resumes. -
MODE = 0queries the current activation status without changing it.
This mechanism is not the same as removing the device from the project; the device is "known" but "not in service". For S7-1200, the instruction is in the standard TIA Portal library and is supported on CPUs with firmware V4.x. Use TIA Portal V16 SP1 or newer for full alignment with current documentation.
Prerequisites and Configuration Environment
- CPU: SIMATIC S7-1200, firmware V4.2 or higher (V4.4 recommended for full feature parity with PROFINET V2.4). C-, F-, and T-CPU variants are supported.
- Engineering: TIA Portal V16 SP1 or newer (V17 / V18 acceptable). The
D_ACT_DPblock lives under Instructions > Communication > PROFINET / PROFIBUS. - Optional PROFINET devices must be configured in the device configuration of the S7-1200 (drag in GSD or HSP).
D_ACT_DPcannot activate a device that has not been configured. - The CPU must be in RUN for activation/deactivation;
D_ACT_DPis executable from OB1, OB82 (diagnostic interrupt), OB100 (restart), or a watchdog OB. - For an external HMI (for example a Beijer KPT-600 PN via PROFINET), the protection page mechanism is independent of
D_ACT_DP; only a flag triggers which mode the PLC runs in.
D_ACT_DP with TCON / TDISCON. The latter terminate TCP/UDP application connections (PROFINET CBA open IE), not PROFINET IO ARs. They cannot silence a station fault.D_ACT_DP Interface Definition
| Parameter | Declaration | Type | Description |
|---|---|---|---|
| REQ | Input | BOOL | Edge-triggered start flag (rising edge starts the job). |
| MODE | Input | BYTE / INT | 0 = query state, 1 = activate, 2 = deactivate. |
| LADDR | Input | HW_DEVICE / HW_NILAR / HW_INTERFACE / WORD | Hardware identifier of the PROFINET IO device (taken from the device properties in TIA Portal, e.g. "PN-IO-Device~Head"). |
| RET_VAL | Output | INT | Return value: 0 = job accepted, non-zero = error code. |
| BUSY | Output | BOOL | TRUE while the job is in progress. |
| STATUS | Output | WORD | Detailed status word (see Siemens manual). |
LADDR (HW Identifier) Capture
The HW identifier is a numeric or symbolic handle assigned by TIA Portal. In the Devices & networks editor, right-click the PROFINET device > Properties > System constants, and tick Show. The constant appears under Name of the PROFINET IO device, e.g. "G120_CU240E_2_PN~PN-IO-Device~Head". Some projects use an IO slot handle such as 268; both forms are valid inputs.
Step-by-Step Implementation in TIA Portal
- Open the project and ensure the optional PROFINET device is configured and connected to the S7-1200 PROFINET interface (X1 or X2) in Devices & networks.
- Add an instance DB by dragging
D_ACT_DPfrom Instructions > Communication > S7 Communication or PROFINET into a function block (recommended: an FB so the tags are reusable per call). Assign an instance DB, e.g.iDB_DACT_G120. - Create a global data block
ConfigModewith:-
bExtendedActive: BOOL — set from the HMI protected page (protected via the Beijer KPT-600 user rights). -
bStartOneShot: BOOL — single-cycle pulse from the HMI button or from the startup logic. -
wDACT_Status_G120: WORD — feedback fromSTATUS. -
iDACT_RetVal_G120: INT — feedback fromRET_VAL.
-
- Wire the call. In OB1 (or a dedicated FB), use SCL or ladder:
// Reset detect on ExtendedActive, rising-edge on bStartOneShot
IF "ConfigMode".bExtendedActive THEN
// Activate the optional drive if not yet active
"iDB_DACT_G120".D_ACT_DB(REQ := "ConfigMode".bStartOneShot,
MODE := 1, // 1 = activate
LADDR := "G120_CU240E_2_PN~PN-IO-Device~Head",
RET_VAL => "ConfigMode".iDACT_RetVal_G120,
BUSY => bBusyAct,
STATUS => "ConfigMode".wDACT_Status_G120);
ELSE
// Extended option off, deactivate drive to avoid station fault
"iDB_DACT_G120".D_ACT_DB(REQ := "ConfigMode".bStartOneShot,
MODE := 2, // 2 = deactivate
LADDR := "G120_CU240E_2_PN~PN-IO-Device~Head",
RET_VAL => "ConfigMode".iDACT_RetVal_G120,
BUSY => bBusyDeact,
STATUS => "ConfigMode".wDACT_Status_G120);
END_IF;
- Handle
BUSYproperly:REQmust remain TRUE whileBUSYis TRUE; otherwise the call aborts. - Establish the start conditions:
- Set
bExtendedActivefrom the HMI after successful login to the protected page. - Generate a 1-cycle pulse in
bStartOneShoton a rising edge ofbExtendedActive. Use the startup logic in OB100 to deactivate the device before the first PROFINET AR scan completes.
- Set
- Compile and download the project (hardware and software). Re-start the CPU when prompted.
First-Run Behavior Without the Drive
When the G120 is not connected (or not energized) and bExtendedActive = FALSE, call D_ACT_DP with MODE := 2 in OB100. The PROFINET AR is not opened, so the CPU does not raise a station fault and the SF LED stays off. This is the sequence that makes the S7-1200 behave like an S7-300 with a deactivated slave.
SINAMICS G120 Integration Specifics
The drive is identified by a GSD file in TIA Portal (or via HSP). Common PROFINET-capable control units include:
| Control Unit | PROFINET | Typical Order Number (MLFB) | PROFINET Conformance Class |
|---|---|---|---|
| CU240B-2 PN | 1 port | 6SL3244-0BB12-1BA1 / -1FA0 | CC-A / CC-B |
| CU240E-2 PN | 2 ports | 6SL3244-0BB13-1BA1 / -1FA0 | CC-A / CC-B |
| CU250S-2 PN | 2 ports, PROFIsafe capable (F variant) | 6SL3246-0BA22-1FA0 | CC-A / CC-B |
| CU230P-2 PN | Pump/fan profile | 6SL3243-0BB30-1HA1 | CC-A |
Star or line topology is acceptable on the PROFINET switch. When the G120 is wired but not energized, keep its ports empty of cables downstream (no downstream IO). If the drive is in a deeper ring line, connect it via a PROFINET switch, not inline with the IO line, so the AR failure of the drive does not propagate station faults to other devices.
The G120 takes roughly 3-5 seconds to come ready on PROFINET from power-up. Configure the Watchdog time in the device properties > PROFINET interface > Port statistics to at least 1000 ms to ride out the start window. D_ACT_DP MODE = 2 should be issued before the watchdog expires.
HMI Integration with a Beijer KPT-600
The KPT-600 is a Beijer Electronics HMI (iX series or similar PN-enabled terminal). It connects to the S7-1200 over PROFINET or Modbus TCP (suitable PROFINET/Modbus tags). The "protected page" concept maps to:
- User-rights login on the HMI.
- Set tag
bExtendedActive= TRUE on the PLC after successful login. - Set tag back to FALSE on logout, timeout, or "switch to base mode" button.
The HMI should also display the status returned by D_ACT_DP:
// Compact status word: high byte = BUSY, low byte = activate/deactivate mode
wActReady = (ConfigMode.wDACT_Status_G120 = 16#0000) AND NOT bBusy;
D_ACT_DP Return / Status Codes
| RET_VAL (dec) | Meaning | Recommended Action |
|---|---|---|
| 0 | Job completed or status query OK. | Check BUSY and STATUS for confirmation. |
| 7000 | No job in progress. | Trigger with REQ rising edge. |
| 7001 | First call, job in progress. | Wait; keep REQ high while BUSY. |
| 7002 | Subsequent call, job still in progress. | Wait for completion. |
| 8090 | Assigned logical base address invalid or device unknown to the CPU. | Recapture LADDR from HW configuration. |
| 80A0 / 80A1 / 80A2 | Error on activating the device (negative acknowledgement). | Check cabling, power, device name assignment. |
| 80B0 | PROFINET IO not configured. | Re-check the configured interface in HW configuration. |
| 80C2 / 80C3 | Resource or temporary error. | Retry; reduce number of simultaneous D_ACT_DP calls. |
STATUS codes are documented in the TIA Portal online help under the D_ACT_DP block. If STATUS returns 16#8180, the LADDR is malformed; if 16#8190, the device is already in the requested state.Verification Procedure
- With
bExtendedActive = FALSEand the G120 unpowered, download the project to the S7-1200, perform a restart, and confirm the SF LED is OFF. The diagnostic buffer should not contain a station-fault entry for the G120. - Set
bExtendedActive = TRUEfrom the HMI. Verify the SF and BF LEDs remain off, the G120 reports cyclic exchange OK (monitor0x6999status word or the IO status in TIA Portal online), andRET_VAL= 0 within ~1 s. - Drop the line to the G120 while the drive is activated. Observe a station fault within the watchdog time (default 600-1000 ms). The CPU must not switch to STOP; configure the OB82 diagnostic OB to keep RUN mode active.
- Re-set
bExtendedActive = FALSEand callD_ACT_DPwith MODE = 2. The station fault must clear in the diagnostic buffer within one refresh cycle and the SF LED must go off. - Cycle power to the CPU and verify the start mode matches the last saved
bExtendedActivein the instance DB. For a cold restart, integrate the activation/deactivation in OB100 with a retained flag.
Comparison: S7-300 vs. S7-1200 vs. S7-1500
| Feature | S7-300 | S7-1200 | S7-1500 |
|---|---|---|---|
| Activation block | D_ACT_DP / DEACT_DPS | D_ACT_DP | D_ACT_DP / PE / PN_IOD |
| Available since firmware | V2.x STEP 7 Classic | V4.x TIA Portal | V1.x TIA Portal |
| LADDR type | WORD / physical address | HW_DEVICE system constant | HW_DEVICE system constant |
| PROFINET version | Conformance Class A/B | CC-A/CC-B (V2.3.4 typical) | CC-B / CC-C with PROFIenergy |
| Multiple parallel jobs | Up to 4 simultaneously | Up to 4 (firmware dependent) | Up to 4-8 |
| Used in OB82 / OB100 | Yes | Yes | Yes |
Troubleshooting Matrix
| Symptom | Likely Cause | Remedy |
|---|---|---|
| SF LED blinks, station fault logged for the drive, even though drive is deactivated. | D_ACT_DP called only after the AR scan triggered the fault; OB100 logic missing. | Move the deactivation call to OB100 or perform a CPU restart with the flag already FALSE. |
| RET_VAL returns 16#8090. | Wrong or unmapped HW identifier; symbolic name not yet resolved. | Recapture LADDR from Properties > System constants. |
| CPU does not switch to RUN when drive is missing and D_ACT_DP is in MODE 2. | OB82 not loaded; diagnostic OB missing causes STOP on station fault. | Load OB82 with at least a "do-nothing" body. Confirm via CPU diagnostics > Call environment. |
| Drive not coming back after MODE = 1. | PROFINET device name not assigned; topology port mismatch. | Confirm the device name matches Properties > PROFINET > Device name. Verify port numbers match the topology editor. |
| D_ACT_DP returns 0 but BF flashes. | Cabling issue or wrong topology port assignment. | Use the topology editor to lock the port assignment. |
| HMI tag does not toggle activation. | Tag not refreshed cyclically, polling time too long. | Set HMI acquisition cycle to 1 s for the activation tag. |
Field-Commissioning Checklist
- Confirm the G120 GSDML file version matches the firmware (use a current GSDML without losing diagnostics; pin to a tested version if multi-protocol coexistence is needed).
- Assign a unique PROFINET device name to every G120 in the cabinet (default name from GSD is fine for one machine, but multiple machines must differ).
- Tune the watchdog time on each PN device to 1000 ms or more before the system integrator signs off.
- Verify the KPT-600 HMI does not issue
bExtendedActiveuntil user-rights authentication is complete. - Add a watchdog in OB1: if
bExtendedActive = TRUEand the drive is missing for more than 30 s, automatically roll back to FALSE. - Save a remote backup of the TIA project for firmware updates; D_ACT_DP behavior is binary-compatible across V16-V18.
- Document the activation behavior in the operator manual; inexperienced operators may not understand why a screen sometimes shows fewer controls.
Safety and PROFIsafe Considerations
If the G120 is in a F-CPU environment and uses PROFIsafe, do not deactivate it via D_ACT_DP while the safety program requires the drive. A deactivated PROFIsafe slot transitions the F-system to PASSIVATED and triggers a safety stop. Move drive activation out of the SIL path and keep the safety I/O on a separate F-CPU or on fixed-IO hardware.
D_ACT_DP only for non-safety IO.Alternatives to D_ACT_DP on S7-1200
- Two projects: keep a "base" and an "extended" TIA project. Acceptable for variants, costly for software updates.
- Option handling: use macros or software option keys on the HMI to gate logic but keep all PROFINET devices configured and active. Requires the device to be physically present and powered.
-
Standalone IO: relocate drive control to ET 200SP PN that is physically present; reserve
D_ACT_DPonly for optional sensors and handhelds. - Conditional configuration: TIA Portal V16 introduced variant-based hardware configuration that gates module-level behavior, but it is a compile-time mechanism, not a runtime deactivation.
FAQ
Can D_ACT_DP activate a device that was never configured in TIA Portal?
No. The device must exist in the HW configuration with a system constant LADDR. D_ACT_DP can only switch a configured device between activated and deactivated states.
Why does my S7-1200 still blink red even after calling D_ACT_DP with MODE = 2?
Most likely the call was made after the AR scan; the station fault is already in the diagnostic buffer. Move the deactivation to OB100 so it runs before the first cyclic exchange. Also confirm OB82 is loaded so the CPU does not switch to STOP.
Is D_ACT_DP available on all S7-1200 CPUs?
Yes, from firmware V4.0 with TIA Portal V13 or newer. V4.4 firmware with TIA Portal V16 SP1 is the most reliable baseline for current PROFINET V2.4 conformance.
Does D_ACT_DP work with G120 PROFINET control units?
Yes, for CU240B-2 PN, CU240E-2 PN, CU230P-2 PN, and CU250S-2 PN. Make sure the GSD file is the same version across the project and that the device name matches. Watchdog >= 1000 ms is recommended.
How do I trigger activation from the Beijer KPT-600 HMI?
Bind a tag to a PLC variable such as bExtendedActive. Use the HMI's login/access-rights to gate the button, then issue a single-cycle pulse on the rising edge to drive REQ of D_ACT_DP in MODE = 1 or 2.