S7-1200 CPU 1214C Mode Selector, Scan Cycle, and Memory Reference

David Krause12 min read
S7-1200SiemensTechnical Reference
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview

The SIMATIC S7-1200 CPU 1214C is a compact controller in the Siemens S7-1200 family. Unlike the older S7-300 and S7-400, and unlike the S7-1500, the CPU 1214C ships without a physical mode selector on the front of the module. There is no RUN/STOP/MRES toggle to turn by hand. Every change between RUN, STOP, and reset-to-factory must be triggered either from the engineering station (PG/PC running TIA Portal) or from a HMI / OPC UA / Modbus peer that holds the appropriate permission, or from the CPU's Web Server.

This reference consolidates the three engineering questions that arise from the missing mode selector:

  1. How do operators start or stop the CPU when no PG and no TIA Portal are available?
  2. How does scan order affect a network that sets and resets the same tag in a single scan?
  3. When should M-bit scratch memory be preferred over direct Q-bit writes, and how is L (local) memory addressed in TIA Portal?

All S7-1200 firmware from V1.0 through V4.7 (latest publicly released) is covered; specific restrictions apply to TIA Portal V11 SP2 builds.

CPU 1214C Hardware Layout and the Missing Mode Selector

The CPU 1214C comes in two DC/DC/DC and DC/DC/RLY variants (Siemens catalog 6ES7214-1AG40-0XB0 for DC/DC/DC and 6ES7214-1BG40-0XB0 for DC/DC/RLY). Front-panel elements are:

Element Function User Interaction
Status LEDs (RUN/STOP/ERROR/MAINT) Indicate CPU state Read-only
Power terminals (L1/N, M, 24 V out) Supply the module Wire only
DI / DO / AI terminals On-board I/O Wire only
PROFINET port (X1, X2 on newer models) Communication Wire only
Memory card slot Load SIMATIC memory card Insert only - no toggle

Compare this to the S7-1500 CPU 1515-2 PN, whose mode selector sits to the right of the display and exposes three positions with mechanical feedback (see S7-1500 Mode Selector):

  • RUN – CPU executes the user program; configuration changes are blocked.
  • STOP – CPU does not execute the user program; outputs go to the configured substitute or keep-last value.
  • MRES – momentary position to perform a memory reset / retain reset.

The S7-1200 collapses that mechanism into software control. Three factors justify the design choice:

  1. Cabinet depth in compact machines is often below 250 mm; the toggle would force a wider housing.
  2. Unauthorized physical access to the cabinet must not allow an operator to pull the system out of RUN.
  3. Remote service is the primary restart path for modern remote-pump and HVAC applications, so the controller is HTTP/Modbus/OPC UA reachable anyway.

Starting and Stopping the CPU Without a PG

Operators routinely need to stop a machine for maintenance without opening TIA Portal. The four accepted procedures are listed below in order of recommendation.

Procedure 1 - TIA Portal online command (engineering station only)

  1. In the project tree, mark the CPU 1214C node.
  2. Open the menu Online.
  3. Select Start CPU or Stop CPU. The dialogue confirms access level and operator name.

This is the official method documented in Siemens Support entry 88781826. The RUN/STOP LED on the front of the CPU toggles within 100-300 ms after the command.

Procedure 2 - HMI button wired to the PLC tags

On any SIMATIC HMI (Basic Panel KTP400 Comfort, or a WinCC Runtime Advanced PC) create a button and link its Pressed event to a tag that drives the following program.

// Bit in an FB "HMI_Control" static area
#bStart := bHmiStart;
#bStop  := bHmiStop;

// Drive the CPU mode through the system clock bits
IF #bStart THEN
    "SetCPU_To_RUN"();   // FB using SFB 23/24 or WRREC to PASS opcode
END_IF;
IF #bStop THEN
    "SetCPU_To_STOP"();
END_IF;

On the S7-1200 the cleanest implementation uses the system function block WRREC to write record 0x0010 (operating mode) of the device. Wrap it in a vendor-supplied FB or the Open User Communication block from the S7-1200 Motion Control library. Implementation note: only a client with the Operating Mode access right can move the controller; the standard project defaults grant this to all HMI devices on the same subnet unless the security configuration is hardened in TIA Portal > Project tree > CPU > Properties > Protection.

Procedure 3 - Web Server page

  1. Enable the Web Server under CPU Properties > Web Server and assign an administrator name/password.
  2. Create a user-defined web page that calls a function block ("Web_Run_Stop") which writes record 0x0010.
  3. Operators reach the panel via http://<CPU-IP>/ using any browser, sign in, and toggle RUN/STOP.
Security note. The Web Server is plain HTTP on every firmware prior to V4.4. From V4.4 forward HTTPS can be selected. Do not expose the controller on a routable network without HTTPS or behind a VPN.

Procedure 4 - Discrete wiring with password-protected authority

For machines without an HMI a digital input configured with "CPU stop from digital input" provides a hardware line to shut down. Enable the option under CPU Properties > System > CPU stop from digital input; choose the DI; define an edge ("Falling") and a hard delay. A momentary dry contact across the configured pair of terminals drops the CPU to STOP. This is field maintenance, not an operator control, so reserve it for E-Stops' safety chain or for panel cut-out door switches.

Scan Cycle and Order of Solve in the S7-1200

The S7-1200 executes the user program in the cyclic organization blocks OB1 (priority class 1) and any additional cyclic OBs added by the user or by libraries (OB 200, OB 201, ...). Each cycle follows the same four phases:

  1. Output of the process-image partition onto the physical outputs.
  2. Read the inputs into the process-image partition.
  3. Execute the user program from the first network of OB1 through the last network of the lowest-priority OB still scheduled.
  4. Run the self-test, refresh the communication stack, copy image back to outputs.

Within step 3, the CPU solves networks strictly from top-left network to bottom-right network in the listed network order. There is no pre-processing, no parallel evaluation, no compiler reordering - the literal sequence of networks is the scan order. The principle is identical to traditional relay wiring: the left side of the rung is solved before the right side, and the top rung is solved before the rung below it.

Order-of-solve pitfall - set/reset in the same scan

Consider this ladder pattern in a single network:

|  Tag1    Tag2              Tag3 (SET coil)  |
|  --||--+--||--(S) Tag3                              |
|                  Tag3 (RESET coil)                  |
|                  --||/ (R) Tag3--                   |

If Tag1, Tag2 and the normally-closed contact of Tag3 are all TRUE during the same scan, the network writes Tag3 = 1 with the set coil before it evaluates the reset line. In ladder logic the entire rung is solved left-to-right, so the reset at the same priority level in the same network runs after the set, and Tag3 ends the scan as 0.

This is the classic "order of solve" gotcha. Three rules keep the program deterministic:

  1. Never drive a coil from two parallel branches in the same network if both branches contain logic that could go TRUE simultaneously.
  2. Use the explicit SR/RS flip-flop instanced in the Instructions > Bit logic catalog; its internal priority is fixed (SR: reset wins; RS: set wins) and identical on every firmware.
  3. Split the set and reset across two networks of known order (set above, reset below) so the reviewer's mental model matches the CPU's execution.

Example - scan-safe toggle

The textbook edge-triggered T flip-flop with two networks:

NETWORK 1   // Detect rising edge of Tag_in
      "Tag_in"  P
      FP_Trig    M0.0
NETWORK 2   // Toggle on the rising edge
      M0.0         "Tag_latch"   CN
      --||---------(CN)--------------

The rising-edge bit M0.0 is set by FP_Trig during scan N and cleared by the system at the start of scan N+1 (OB1 PRIOFLAGS in IEC 61131-3). The toggle contact <CN> runs once per cycle because M0.0 is single-shot. Result: the flip-flop changes state exactly once per rising edge of Tag_in - regardless of how long the input remains TRUE.

M Memory vs Q Memory - When to Use Each

M memory (Merker) is the workhorse scratchpad of the S7-1200. The default address range is MB0 ... MB4095 (4 KB) on CPU 1214C, 1215C and 1217C, shared by all OBs. M bits are not wired to anything physical; they exist only in the CPU's load memory and process image.

Property M memory (Merker) Q memory (Process output)
Physical binding None Bound to a digital / analog output channel
Can be used in another OB without side-effect? Yes No - change before I/O assignment takes effect
Reuse across projects Generic, copy-paste safe Project-specific; tied to hardware
Watchdog visible in trace Yes Yes
Forces available Yes (from firmware V3.0) Yes

The canonical pattern is to compute generic logic with M bits and DB tags, then write the final Q bit in a single network that maps "Machine.Heat_On" to Q0.0. This decouples engineering: the algorithm can be unit-tested, transferred, and reused without rewiring. Forcing a Q bit from TIA Portal temporarily bypasses the logic; forcing an M bit temporarily modifies the algorithm - the latter is usually what is desired when troubleshooting.

Allocation recommendations

  • Reserve MW0 ... MW99 for engineering, simulator, and test routines - never used by application code.
  • Reserve MW100 ... MW199 for hand-shake flags between cyclic OBs (cycle handshake, edge latch).
  • Use DB tags for application state. Naming convention stat.<area>.<name> or data.<area>.<name> improves searchability.

L (Local) Memory in TIA Portal V11 SP2

The S7-1200 supports local tags declared inside a code block (OB, FB, FC) with the Local keyword. Local memory lives in the L stack and is consumed while the block executes.

Storage class Availability Retained? Default in V11 SP2
Static (FB only) stat Across calls (instance DB) Configurable, retained flag Yes for FB
Temp temp During one call only No Yes for FC and OB
Constants const Compile-time Yes Yes

Declaring a local

  1. Select the FB/FC/OB.
  2. In the upper section declare a new row; choose Temp for transient data or Static for instance data.
  3. Enter a name, datatype and start value. Example for a toggling FB:
FB "ToggleFB" - Interface
VAR_TEMP
    tInputEdge   : BOOL;    // rising edge of the call input
    tState       : BOOL;    // toggled value
    tLastInput   : BOOL;    // edge memory
END_VAR

Accessing locals from LAD/FBD

In TIA Portal V11 SP2 the local tags are visible only in the interface editor and in code blocks that are inside the same FB/FC. They are deliberately hidden from the project-wide tag table - that is the reason local memory is safe against accidental reuse.

Common pitfalls with L stack in V11 SP2

  • If a multi-instance FB is instantiated inside another FB without its own DB, the V11 SP2 compiler emits a Multiple instance DB required warning. Resolve by enabling Properties > Compilation > Single instance DB or supplying a multi-instance DB.
  • Temporary variables initialized with a value lose that value on the next call of the same FC. Do not use temporaries for counter or state bits.
  • Renaming a local variable invalidates references in libraries cached in TIA Portal V11 SP2. Clean the project (Project > Compiler > Show information > Rebuild all) before reinstalling the libraries.

TIA Portal V11 SP2 Project Compatibility

TIA Portal V11 SP2 introduced the binary project container .ap11; legacy SIMATIC Manager projects (Step 7 V5.x) end in .s7p or are stored in a Step 7 archive *.zip. A direct open is not supported. To migrate: launch Step 7 V5.5, select the project, choose File > Save as > Migration export, then open the migrated file in TIA Portal V11 SP2 through Project > Migrate project. Libraries delivered as .s7l (Step 7 V5.x Library) cannot be opened in TIA V11; they must be converted with the S7 Library Migration tool that ships with TIA V11 SP2 Update 2.

TIA Portal V11 SP2 targets S7-1200 firmware ≤ V3.0. For firmware V4.x use TIA Portal V13 SP1 or later. For firmware V4.4 and V4.5 / V4.6 / V4.7 use TIA Portal V15.1, V16/V17 (compatibility mode) or V18. V11 SP2 projects can be migrated upward with the standard Project > Upgrade command.

Verification Checklist

After any change to RUN/STOP logic, scan guard, or block interface, validate with the table below.

Check Expected Result Tool
CPU enters RUN from HMI button RUN LED solid green within 500 ms Online > Diagnostics > CPU
Stop is honored Outputs switch to substitute / keep-last Watch table + multimeter
Toggle FB changes state once per edge Sequence of 5 edges produces 5 toggles Trace or watch table
Order-of-solve network behaves Last write wins per scan Trace with 1 ms resolution
Local memory discarded on FC call Counter initialized to 0 each call Watch table
FB instance maintains state Counter increments across calls Watch table

Troubleshooting Matrix

Symptom Likely Cause Corrective Action
CPU does not enter RUN from TIA Portal Protection level set to "No access (complete protection)" CPU Properties > Protection, supply password or download from PG/PC
RUN/STOP LED flashes (buzzer) but no error in diagnostic buffer Operator HMI lacks "Operating Mode" authorization Adjust HMI user management - grant privilege to the HMI connection
Tag toggles itself off within one scan Set and reset coil in the same network, parallel branches Replace with SR/RS flip-flop, or split into two networks with explicit order
HMI button has no effect Cycle handshake places event into wrong OB Place the SetCPU function in cyclic OB1, not in startup OB100
Local variable appears unchanged after edit V11 SP2 compiler did not rebuild interfaces Project > Compile > Software (rebuild all)
Example program (.ap10) will not open in V11 SP2 Project written by V13 or later, or V10 with newer firmware Open in correct TIA Portal version or upgrade the project
CPU stops spontaneously Web Server session ran the STOP command by mistake, or DI stop line pulsed Lock cabinet door; review diagnostic buffer entries under "System / STOP caused by ..."

Frequently Asked Questions

How do I start or stop a CPU 1214C without a programming device?

Use any HMI with operator authorization, the Web Server start/stop page, or the digital-input "CPU stop from digital input" line. TIA Portal online commands remain the configuration path; operators should rely on the Web Server or HMI in production. Refer to Siemens Support 88781826.

Why does a set coil followed by a reset coil in the same network stop working?

The S7-1200 solves networks left-to-right and top-to-bottom. A set and reset in the same network during one scan evaluate both branches, and the second evaluation wins; the result is no net change or wrong polarity. Use the SR or RS flip-flop block, or split the two operations into separate networks with a known order.

When should I use M bits versus output Q bits?

Reserve M memory for all intermediate logic and hand-shake; bind the final state to Q bits in a single mapping network. M bits are project-neutral, re-usable across hardware, easier to debug with watch tables, and unaffected by output-forcing.

How are local (L) tags declared in TIA Portal V11 SP2?

Open the FB/FC/OB interface editor, declare VAR_TEMP for transient variables or VAR_STAT for instance variables. The L stack is allocated per call and freed when the block exits; static variables remain in the instance DB until the FB goes out of scope.

Can I open STEP 7 V5.5 example projects in TIA Portal V11 SP2?

Only after running the Save as - Migration export in Step 7 V5.5 or the project migration tool that ships with TIA V11 SP2 Update 2. Direct open of .s7p archives is not supported, and libraries written for newer TIA versions will not open in V11 SP2.

Back to blog