中文官网

To Siemens S7-1200: sample program & common input wiring

Quick answer: Ordinary S7-1200 inputs and the sample monitoring code do not perform a safety function. Route the OSSD pair to a compatible safety relay/controller, or use a supported F-CPU/F-I/O arrangement with a validated safety program. Read independent status copies in the ordinary PLC. EDM, reset timing and restart inhibition must remain in the documented safety path.

Content updated: .

Diagnostic mapping example. Map status from a safety light curtain’s OSSD1/OSSD2, EDM, and RESET using independent indications on ordinary Siemens S7-1200 digital inputs (module-compatible signals), with an illustrative I/O list, TIA Portal example logic (standard CPU monitoring and S7-1200F safety option), plus commissioning records.

Safety boundary: A standard S7-1200 CPU is not a safety PLC. The safety stop must be executed by a safety relay/controller + K1/K2 contactors. If you use S7-1200F (F-CPU with F-DI/F-DO and F-program), the safety function may reside in the PLC when the complete sensor, F-program and final switching arrangement is validated.

1) Common input wiring (PNP / NPN)

The light curtain wiring and commissioning hub sets out the installation sequence. Compare the FX5U diagnostic I/O example only as a mapping reference; connector and input compatibility must be checked for each PLC.

PNP (sourcing) — recommended

RATED PATH
OSSD1/OSSD2 -> compatible safety inputs -> validated final elements
K1 mirror NC -> K2 mirror NC -> rated EDM input, if supported
Reset -> safety device reset input, if required

ORDINARY S7-1200 DIAGNOSTICS — independent status copies
Channel A status -> I0.0
Channel B status -> I0.1
Controller feedback-ready indication -> I0.2
Independent reset-button indication -> I0.3
Input reference M (0 V): verify exact module and status output.

Ordinary DI use documented positive status signals referenced to M (0 V) for this example.

NPN (sinking)

No generic NPN rewire is specified here.
Read the exact CPU / signal-module input circuit.
Do not connect M to L+ to turn a PNP input into an NPN input.
Use only a documented compatible diagnostic interface.
Keep the OSSD safety path on compatible rated safety inputs.

NPN compatibility is module-specific. Never change the supply reference contrary to the module wiring diagram.

2) Copy-ready I/O map & naming

VariableAddress (typ.)SourcePurposeRemarks
LC_OSSD_CH_AI0.0Channel A status copyDiagnostic channel ADocumented auxiliary signal
LC_OSSD_CH_BI0.1Channel B status copyDiagnostic channel BDisplay only
LC_EDM_FBI0.2Controller status outputFeedback status onlySafety device controls reset
LC_RST_BTNI0.3PushbuttonReset-button indicationEvent log only — not reset permission
LC_STATUS_OKM100.0LogicLC healthyInternal
LC_RESET_EVENTM100.1LogicReset log eventOne scan only

3) Example program — standard S7-1200 (monitoring)

This example is for a non-safety CPU. It provides status display and event logging only. The actual safety stop is executed by the external safety relay/controller.

LADDER (conceptual)

// Diagnostic pseudocode, not a protective-stop program
| I0.0  I0.1 |----( M100.0 )  // HMI channel status
| I0.2      |----( M100.2 )  // HMI feedback-ready indication
| I0.3  rising-edge |----( M100.1 ) // reset log event
// No contactor command, safety output or restart permission.

STRUCTURED TEXT (TIA Portal SCL)

// Illustrative tags; declare them in the project.
// Inputs are documented non-safety status copies.
M100_0 := I0_0 AND I0_1;       // channel-status display
M100_2 := I0_2;                // feedback-ready display
M100_1 := I0_3 AND NOT RSTprev; // one-scan log event
RSTprev := I0_3;
// Raw NC feedback is not a run-enable signal.
// This program does not implement EDM, safe reset or restart.

4) Example concept — S7-1200F (safety CPU)

With an S7-1200F CPU and certified F-DI/F-DO, implement the safety function in F-blocks and drive K1/K2. Below is a conceptual mapping; use certified F-library blocks and follow your company validation plan.

CONCEPT ONLY — no assumed library block or pin assignment
1. Select the supported F-CPU, F-I/O and compatible OSSD sensor.
2. Configure the documented sensor evaluation and fault response.
3. Implement required restart/feedback functions using supported instructions.
4. Connect rated outputs to the validated final switching arrangement.
5. Verify response time, fault reaction and required PL/SIL.
6. Document and validate the complete machine safety function.
Do not copy ordinary I0.x monitoring logic into an F-program.

5) Commissioning & periodic verification

  1. Polarity: confirm the exact module input diagram; verify supply, M reference and protective bonding.
  2. Channel coherence: block/release beams; verify channel fault detection at the rated safety device; I0.0/I0.1 provide diagnostic indication only.
  3. EDM logic: secure the hazard and follow the approved feedback-fault test. Never mechanically hold a live contactor.
  4. Reset behavior: verify the documented safety-device reset and machine restart requirements.
  5. Safety distance: compute per ISO 13855 and file it with the I/O list and photos.

Self-test record (CSV copy)

Item,Test,Expected,Actual,Result,Notes
1,Status indication,PLC display follows documented status outputs,,,
2,Protective stop,Rated safety path reaches specified safe state,,,
3,Feedback fault test,Approved procedure inhibits restart,,,
4,Reset function,Matches validated machine reset requirements,,,
5,PLC diagnostic failure,Safety path remains effective,,,
6,Records,Actual I/O and validation results archived,,,

6) Common mistakes & fixes

MistakeSymptomFix
Mixing PNP/NPN on same DI groupInputs stuck ON/OFFUnify polarity per DI common; segregate wiring
No EDM feedbackRestart despite welded contactorSeries K1/K2 mirror NC to the rated EDM input
Unverified OSSD load or wiringTest-pulse or fault-detection mismatchFollow both device manuals
Reset held continuouslyUnintended restart riskUse documented safety-device reset; PLC may log events
Assuming standard CPU is “safe”Compliance failureUse safety relay/controller or S7-1200F with F-I/O

7) FAQ

Can I connect OSSD directly to S7-1200 and perform the stop in PLC?

With a standard CPU: No. PLC only displays status and logs events. Use a safety relay/controller to cut power. With an S7-1200F and supported F-I/O, implement and validate the safety program and appropriate final switching devices.

Which polarity should I pick, PNP or NPN?

This diagnostic example uses supported PNP signals referenced to M (0 V). Check the exact module diagram; do not move M to +24 V to assume NPN support.

How do I log reset attempts for audits?

One-shot the independent reset-button indication and log a timestamp. This event record neither grants reset permission nor proves that the safety controller accepted a restart.

Manufacturer reference

Siemens S7-1200 Functional Safety Manual distinguishes standard application I/O from the fail-safe configuration. Use the edition and module instructions applicable to the installed equipment.

Frequently Asked Questions

How do I wire a safety light curtain to a Siemens S7-1200?

Use a compatible documented safety relay/controller, or a supported fail-safe F-CPU with compatible F-I/O and a validated safety program, for the OSSD safety path. Adding an F input module to an ordinary CPU does not establish a safety controller. The I0.0–I0.3 map in this article reads independent auxiliary status and button indications only.

Should I use PNP or NPN with an S7-1200?

Check the exact module manual. This example uses supported positive PNP diagnostic signals referenced to M (0 V). Do not move M to +24 V to assume NPN compatibility. A different supported input or interface may be necessary; it must not compromise the safety path.

Can the S7-1200 handle the safety stop directly?

A standard S7-1200 CPU cannot implement the protective stop using ordinary logic. Use a documented safety relay/controller or a supported S7-1200F F-CPU, compatible F-I/O and validated safety program with suitable final switching elements. Standard diagnostic logic must not grant reset or restart permission.

What goes into the I/O map?

Map each OSSD channel to a compatible rated safety input. The ordinary I0.0–I0.3 map here labels independent channel status, feedback-ready and reset-event indications only; record the actual source and signal meaning for each.

How do I verify the program and wiring?

Validate the complete protective function using approved machine and device procedures, including measured stopping performance, required feedback and fault response, restart prevention and test-piece checks. Verify OSSD test-pulse compatibility at the rated safety input. Check that diagnostic faults do not defeat protection and retain the results.