1. Overview
An S7-1200 CPU does not have a physical mode selector like the S7-300/400 or LOGO! 8. Operating state transitions (STOP, STARTUP, RUN) are normally commanded from the TIA Portal online interface. When the engineering PC is unavailable — for example, a lost or failed laptop, a customer site with restricted access, or a remote panel build — the CPU can still be brought to RUN through one of four supported paths:
- HMI (Comfort, Unified, or Basic Panel) using the system function
SetPLCMode - Integrated Web Server of the S7-1200 (firmware V4.0 and later)
- TIA Automation Tool (a free Siemens utility that runs on a tablet or any Windows host)
- Configured warm restart after POWER ON, combined with a clean power cycle
This reference documents each method, the prerequisites, the exact configuration steps, and the verification checks to confirm the CPU is in RUN. It also covers the common reasons a CPU refuses to leave STOP even when commanded.
All references point to the Siemens TIA Portal documentation portal and the TIA Portal V20 online help hosted at docs.tia.siemens.cloud.
2. S7-1200 Operating States Reference
| State | LED (RUN / STOP / ERROR / MAINT) | User program | Typical trigger |
|---|---|---|---|
| STOP | STOP on, RUN off, ERROR off | Not executed | Power-on default with no startup configured; STOP commanded from engineering tool or HMI |
| STARTUP (OB100) | RUN flashes, STOP on | OB100 executed once; process image not updated | Mode change to RUN; warm restart at POWER ON |
| RUN | RUN on, STOP off | Cyclically executed (OB1) | Successful startup completion |
| HOLD | RUN and STOP both on | Frozen; breakpoints active | Test/single-step from TIA Portal only |
| ERROR / FAULT | ERROR on, RUN off, STOP flashes | Not executed | Diagnostic interrupt, programming error, wiring fault, I/O fault |
3. Prerequisites
Before applying any of the four methods, verify the following:
- The S7-1200 CPU is installed, wired, and powered (24 V DC on terminals 1L+ / 1M, 2L+ / 2M where applicable).
- The hardware configuration has been downloaded to the CPU at least once from TIA Portal, including the IP address, subnet mask, and PROFINET device name.
- The project contains a valid, error-free user program that has been compiled with "Software (all blocks)" download.
- The CPU's IP address is reachable on the same subnet as the requesting device (HMI, TIA Automation Tool host, or web browser host).
- For the HMI method: the HMI project must have an HMI connection of type "S7-1200" or "S7-1500" pointing at the CPU and must have been downloaded to the panel.
- For the Web Server method: the Web Server must be enabled in the CPU properties and at least one user with the "Operating mode" or full rights must be configured (CPU firmware V4.4+ supports user administration; earlier versions used the single admin password).
4. Method 1 — HMI SetPLCMode Function
This is the most common and most robust path. Every Comfort Panel, Unified Comfort Panel, KTP Basic, and TP Basic running a TIA Portal HMI project supports the system function SetPLCMode. The function takes two arguments and writes them to the CPU using the existing HMI connection.
4.1 Function signature
| Argument | Type | Allowed values | Description |
|---|---|---|---|
| Connection | HMI connection | Pointer to a configured S7-1200/1500 connection | The PLC whose mode is to be changed. Multiple HMI connections in the project means you must pick the correct one. |
| Mode | Int / DInt | 0 = STOP, 1 = RUN, 2 = STARTUP (warm restart) | Target operating state. 1 is the most common for normal machine start. |
4.2 Step-by-step configuration
- Open the TIA Portal project that contains the HMI and the S7-1200.
- In the project tree, expand the HMI device and select
Screens. - Open the screen that should trigger the RUN command (typically the start-up or home screen).
- Drag a button onto the screen. In the properties, set
Event > Press. - Add a new function:
SetPLCModefrom the system functions list (folder: PLC control or System functions depending on TIA Portal version). - For
Connection, select the configured HMI connection to the S7-1200. - For
Mode, enter1for RUN. Create a second button using the same function withMode = 0for STOP. - Compile the HMI project and download it to the panel.
4.3 Optional: HMI tag status feedback
To confirm the transition succeeded, add a "PLC status" indicator. Read the standard S7-1200 diagnostic tag or use an HMI area pointer of type Coordination. The HMI area pointer for "Coordination" carries a bit that reflects the current operating mode; map the mode bit to a text field "RUNNING" / "STOPPED" so the operator has visual confirmation.
4.4 Limits and caveats
- The HMI must already be online with the CPU. If the HMI shows "No connection", fix the physical Ethernet link or PROFINET name first.
-
SetPLCModerequires PLC read/write rights in the CPU protection configuration. The default "Full access (no protection)" works; the configuration "Read access only" will reject the command silently. - If the CPU is in ERROR,
SetPLCModeto RUN will fail. Clear the fault first (see troubleshooting matrix).
5. Method 2 — Integrated Web Server
The S7-1200 Web Server (CPU firmware V4.0 and later) exposes standard web pages at http://<cpu-ip-address>. With firmware V4.4 and later, an authenticated user with the "Operating mode" right can trigger a RUN/STOP transition directly from the "Diagnostics" or "Module information" page in modern firmware, or by clicking the operating-mode toggle in the standard homepage banner of newer CPUs.
5.1 Enabling the Web Server
- In TIA Portal, open the CPU device view.
- Select
Properties > Web server > General. - Check
Activate web server on this module. - For firmware V4.4 and later, add a user under
User managementand grant the role Diagnostics (which includes the operating mode toggle on the standard pages). - For firmware V4.0–V4.3, define the admin password in the same dialog.
- Compile and download the configuration to the CPU.
5.2 Triggering RUN from a browser
- Open a browser on a host in the same subnet.
- Enter
http://<cpu-ip-address>. - Log in with the configured user (or admin password for V4.0–V4.3).
- Navigate to the module / operating mode area and click the toggle to RUN.
6. Method 3 — TIA Automation Tool
The TIA Automation Tool is a free Siemens utility that scans a PROFINET network, lists every S7-1200/1500, and supports scripted operations including a RUN/STOP command. It runs on any Windows host — including lightweight tablets — and only requires the IP address range, not the original TIA Portal project.
6.1 Workflow
- Install the TIA Automation Tool on a Windows host with Ethernet access to the S7-1200 subnet.
- Launch the tool and run a network scan.
- Identify the target CPU by its IP address or PROFINET name.
- Right-click the device and select Operating mode > RUN.
- The tool reports back the new operating state; the CPU LED pattern changes from STOP to RUN within one second.
For repeated operations, the tool supports a command-line interface and a scriptable API, which makes it suitable for a "lost laptop" recovery situation: copy the executable to a USB stick and run it from any available machine.
7. Method 4 — Warm Restart at POWER ON
The simplest, zero-tools approach. If the CPU is configured to enter RUN after a power cycle, and the project is free of startup-inhibiting errors, power-cycling the 24 V supply is enough to start the machine.
7.1 Configuration
- Open the S7-1200 device view in TIA Portal.
- Select
Properties > Startup. - Under Startup after POWER ON, select Warm restart - RUN (the default for S7-1200).
- Download the configuration to the CPU.
7.2 Operating procedure
- Confirm the CPU is currently in STOP (STOP LED steady on).
- Remove the 24 V DC supply, wait at least 3 seconds, then re-apply.
- The CPU performs its startup routine, executes OB100 once, and transitions to RUN.
8. Method 5 — Alternative Approaches
When none of the HMI / Web / Automation Tool paths is available, consider:
- Programmatic command inside the user program: Use the SFC / instruction STP only for STOP; the inverse (RUN) is not a writable instruction from the user program for safety reasons.
- MRES / memory reset: A memory reset returns the CPU to factory state and is not a route to RUN with a loaded program — only use it for recovery when the project is about to be reloaded.
- Remote access via SINEMA RC or another VPN gateway: If the panel network has a Siemens remote-access router, an engineer at the home base can reach the CPU and use the TIA Portal online functions as if locally present.
9. Verification Procedure
After issuing the RUN command via any of the methods above, verify the transition took effect:
- LED check: RUN LED steady on, STOP LED off, ERROR LED off.
- Program execution check: Force a known tag, or monitor an OB1 output tag from the HMI or Web Server diagnostics page and confirm it changes every scan cycle.
- Diagnostic buffer check: Open the diagnostics buffer (Web Server > Diagnostics > Diagnostic buffer, or HMI diagnostics view). The most recent entries should show the mode transition from STOP to RUN, with timestamp and trigger source.
- Communication check: Confirm HMI tags refresh, PROFINET IO devices are in data exchange, and any TCP/IP partners (Modbus, OPC UA, S7 communication) report a healthy connection.
10. Troubleshooting Matrix
| Symptom | LED pattern | Most likely cause | Corrective action |
|---|---|---|---|
| CPU stays in STOP after SetPLCMode(1) | STOP on, RUN off | CPU in error or read-only protection | Check ERROR LED, review CPU protection level, read diagnostic buffer |
| CPU returns to STOP within 1 s of RUN | RUN briefly on, then STOP on, ERROR flashes | Programming error in startup OB | Inspect diagnostic buffer, correct the fault in TIA Portal, reload |
| SetPLCMode button does nothing on HMI | CPU LEDs unchanged | HMI has no connection / wrong connection selected | Verify HMI connection in project, check Ethernet link and PROFINET name |
| Web Server RUN/Stop toggle is grayed out | N/A | Logged-in user lacks the right | Add a user with Diagnostics role and log in with that user |
| Web Server page does not load | CPU may be cycling | Web Server not activated, or HTTPS / certificate mismatch | Confirm "Activate web server" in CPU properties, check the URL uses http:// for default port 80 |
| Power cycle does not bring CPU to RUN | ERROR on | Hardware fault, missing module, or invalid configuration | Read diagnostic buffer, verify all configured modules are installed and reachable |
| TIA Automation Tool cannot see the CPU | CPU is on a different subnet | PC / tool host is on a different subnet or VLAN | Set the host to the same subnet, or add a route |
11. Field-Notes and Best Practice
- Always build an HMI button set with both
SetPLCMode(0)(STOP) andSetPLCMode(1)(RUN) before shipping the panel. The cost of one extra button is trivial; the cost of a stranded machine is not. - For each HMI connection, name it descriptively (e.g. PLC_Line1) — the connection drop-down is the most common source of "SetPLCMode does nothing" field calls.
- When commissioning a new CPU, perform at least one power-off / power-on test to confirm the configured startup mode is correct. A CPU that enters STOP after a brown-out will look identical to a CPU that has a programming error.
- Keep a copy of the TIA Automation Tool executable on a USB stick in the cabinet. It is the most universal recovery tool for S7-1200 / S7-1500 fleets and runs on any Windows host.
- Document the CPU's IP address, PROFINET name, and Web Server admin password on the inside of the cabinet door — not in the project file alone.
12. FAQ
Can the S7-1200 be put into RUN mode with no PC and no HMI at all?
Yes, provided the project has been downloaded once and the CPU is configured for Startup after POWER ON: Warm restart - RUN. A clean power cycle will then start the CPU. If the CPU is in ERROR, fix the underlying fault first — power cycling alone will not clear a programming or wiring error.
What values does the SetPLCMode "Mode" argument accept?
The Mode argument accepts an integer: 0 = STOP, 1 = RUN, 2 = STARTUP (warm restart). For normal machine start, use 1. For forcing OB100 to re-run without a full power cycle, use 2 (only supported on firmware versions that distinguish startup from a fresh run).
Does the Web Server of the S7-1200 allow changing the operating mode?
On CPU firmware V4.4 and later, an authenticated user with the Diagnostics role can toggle RUN/STOP from the standard web pages. On firmware V4.0–V4.3 the Web Server is read-only on the operating state. The Web Server must be activated in the CPU properties first.
Why does SetPLCMode fail silently from the HMI?
The most common cause is that the wrong HMI connection is selected in the function call, or the CPU's access protection is set to Read access only. Verify the connection name, the Ethernet / PROFINET link, and the CPU's protection level (full access with no password is the commissioning default).
What is the difference between "Warm restart - RUN" and "Warm restart - Operating mode before power off"?
Warm restart - RUN always forces the CPU to RUN at power on. Mode before power off returns the CPU to whichever state it was in when power was removed — useful if the panel intentionally placed the CPU in STOP for maintenance. For unattended startup, choose Warm restart - RUN.