Overview
The Siemens SIMATIC S7-1200 CPU 1214C retains process values across power cycles only for tags that are explicitly marked as retentive in the project. The default TIA Portal project leaves all tags non-retentive, so values written to %MW, %MD, global PLC tags, and Data Block tags are cleared during the STOP-RUN transition and after a power-loss cold start. This reference walks through configuring retentive tags on the CPU 1214C AC/DC/RLY (6ES7214-1AG40-0XB0), resolves the common "greyed-out Retain column" symptom, and provides verification steps, capacity tables, and alternate storage strategies (DB-level Retain attribute, recipe DB, recipe view on SIMATIC Memory Card).
Prerequisites
- Siemens TIA Portal V15 or newer (V17 / V18 recommended for projects using CPU firmware V4.4 or V4.5).
- CPU firmware V4.2 minimum; V4.4 or V4.5 typical in 2023-2024 builds.
- CPU part number 6ES7214-1AG40-0XB0 (SIMATIC S7-1200 CPU 1214C AC 120/230 V / DC 24 V inputs / Relay outputs).
- Project open with the CPU device configured and an online path (PROFINET, PROFIBUS, or serial) to the S7-1200 for the verification step.
- Edit rights for PLC tag table and data block properties (know-how protection on enclosing blocks disabled).
Hardware Identification: 6ES7214-1AG40-0XB0
| Parameter | Value |
|---|---|
| Article number | 6ES7214-1AG40-0XB0 |
| CPU family | SIMATIC S7-1200 |
| CPU type | 1214C AC/DC/RLY |
| Supply voltage | 85-264 V AC |
| Work memory (code + data) | 100 KB |
| Retentive work memory (max) | 10 KB |
| Load memory | 4 MB internal; up to 32 GB external via SIMATIC Memory Card (SD) |
| Bit memory (M area) | 8 KB (M0.0 .. M1023.7) |
| Default retentive bytes | 16 bytes (M0 .. M15) |
| Onboard DI / DO / AI | 14 DI 24 V DC / 10 DO relay / 2 AI +/-10 V |
| High-speed counters | 6 (up to 100 kHz on DIa; 30 kHz on DIb) |
| Communication interfaces | 1 x PROFINET (2 ports, switch integrated), 1 x RS485 / RS232 optional via CM |
| Supported firmware | V4.0 or higher |
Refer to the S7-1200 Programmable Controller System Manual (Edition 04/2024) and the catalog entry in the Siemens Industry Mall for full specifications.
Understanding Retentive Memory on the S7-1200
Three memory classes govern value survival across CPU restarts:
- Non-retentive work memory - cleared on STOP-RUN transition, power-down, and cold restart.
- Retentive work memory - values survive STOP-RUN transition, warm restart (OB100), and cold restart. The S7-1200 allocates a contiguous byte range beginning at MB 0; the maximum on the 1214C is 10 KB.
- System-retained memory - certain counters, timers, and diagnostics the firmware retains without explicit user configuration.
Retentivity is decided at compile time. Increasing the retentive byte count consumes the 10 KB budget; if the budget is exceeded, TIA Portal emits a compile error: Retentive memory area too large. Plan the remanence region before declaring tags.
Why the Retain Column Is Greyed-Out
The Retain checkbox in the PLC tag table is disabled under one of the following conditions:
- Tag is mapped to the I, Q, AI, AQ, or PI area. Process I/O cannot be defined as retentive; the operating system overwrites these on every cycle.
- Tag is a member of an optimised Data Block. Retentivity is set inside the DB properties ("Attributes > Retain"), not in the PLC tag table.
- The project's Retain memory byte count is zero. Open CPU properties > Retain memory and set a non-zero value.
- PLC user program has know-how protection set on the enclosing OB/FC/FB with write protection. Remove protection, retry, then re-apply protection.
- Toolbar filter "Hide non-retentive tags" is active. Clear the filter icon in the PLC tag table toolbar.
- Target device differs from the CPU in the project. The S7-1200 retention model is different from the S7-1500 behaviour - check the slot's module selection.
Configuring Retentive Tags Step-by-Step
Step 1 - Allocate Retentive Memory Bytes
- In the project tree, right-click the S7-1200 CPU (for example, PLC_1 [CPU 1214C AC/DC/RLY]) and choose Properties.
- Switch to the navigation entry Retain memory (or Retention on TIA V17+ for firmware 4.4 targets).
- Set Retentive memory bytes. For example, enter
100to make MB 0 .. MB 99 retentive. - Click OK, recompile (Project > Compile > Software (rebuild all)), then download "Hardware and Software (full)" to the CPU.
Step 2 - Mark Tags as Retentive in the PLC Tag Table
- Open PLC tags > Default tag table (or your custom tag table).
- Add a tag:
Name= ProductionCount,Data type= Int,Address= %MW100. - Place a tick in the Retain column for that row. If grey, see the reasons in the previous section.
- Recompile and download to the CPU.
Per the TIA Portal Information System, Help topic "Setting the retentive behavior of PLC tags": "You set the retentivity for PLC tags in the PLC tag table for the S7-1200/S7-1500 CPU series. You can recognize the retentivity setting of a tag by the check mark set in the 'Retain' column of the PLC tag table." Reference: Siemens TIA Portal Help - PLC tag retention (KB entry).
Step 3 - Power-Cycle Verification
- Place the CPU in RUN. Use a watch table to write a value into MW 100:
Modify value = 1234, confirm applied. - Disconnect the AC supply for >= 5 seconds (longer for cold-restart test).
- Reapply power; wait for the CPU RUN LED solid green.
- Reconnect with TIA Portal; read MW 100. Expected value = 1234. If 0, the retentive range was not allocated or the download skipped the remanence table.
Alternative - Retentive Data Block Tags
Siemens' preferred long-term storage on the S7-1200 is a dedicated Data Block with the Retain attribute toggled at the block level; every static tag inside that DB then inherits retentive behaviour.
Creating a Retention Data Block
- Project tree > Program blocks > Add new block > Data block. Name it RecipeDB.
- Select type Global DB. Use optimised block access for modern S7-1200 / S7-1500 use cases; select non-optimised (classic) only if the HMI or third-party device needs absolute
%DBWaddressing. - Open DB properties > Attributes. Tick Retain under Retain attribute.
- Declare static variables:
| Name | Data type | Initial value | Retain (inherited) |
|---|---|---|---|
| Counter | DInt | 0 | Yes |
| TemperatureSP | Real | 0.0 | Yes |
| Mode | Bool | FALSE | Yes |
| OperatorName | String[16] | '' | Yes |
- Compile and download the DB block individually (Program blocks > Download to device > Software (only changes)).
Programmatic access from an OB or FB in SCL: "RecipeDB".Counter := "RecipeDB".Counter + 1;
In LAD/FBD ladder (counter example): L "RecipeDB".Counter / + 1 / T "RecipeDB".Counter
%DBW offset). Non-optimised DBs keep both symbolic and absolute addressing, which is convenient for HMI direct access from third-party panels. Plan for "Status / Force" permissions and download attribute separately per block.M Retain vs DB Retain vs RecipeDB Comparison
| Aspect | PLC tag / M area | Data block (DB) | RecipeDB + Recipe View |
|---|---|---|---|
| Granularity | Byte / word tagging | Per-tag attribute inside DB | Per-recipe set of values |
| Configuration location | PLC tag table + Retain memory bytes | DB properties > Attributes > Retain | Recipe DB + HMI recipe view OR RDP instructions |
| Default on new project | Non-retentive | Non-retentive (must be ticked) | Non-retentive until activated |
| Survives firmware update | No | No | Yes (stored on SIMATIC Memory Card) |
| Survives CPU replacement | No | No | Yes (transfer Memory Card) |
| HMI visibility | Yes | Yes (symbolic or absolute) | Yes - full recipe view editing |
| Maximum size on 1214C | 10 KB shared budget | 10 KB shared budget | Limited by load memory (4 MB internal, up to 32 GB SIMATIC MC) |
RecipeDB and Recipe View (Persistent Storage on Memory Card)
For long-term persistence across firmware updates, CPU replacements, or hot standby CPU swaps, use a RecipeDB with a PLC data type of Recipe. Combine it with:
- The HMI Recipe View object in WinCC / TIA Portal HMI engineering.
- Recipe functions in the user program using
RDP(Read data of recipe) andWRP(Write recipe to recipe DB) system instructions. - File-system export to the SIMATIC Memory Card (recipe directory
/Recipeson the SD card).
Recipe data resides in load memory, not in work memory, so it persists even after a complete firmware update. Reference: S7-1200 Recipes in TIA Portal (Application Note).
Memory Map Reference (CPU 1214C AC/DC/RLY)
| Area | Range | Default retentive | Max retentive |
|---|---|---|---|
| Inputs (I) | I 0.0 .. I 1023.7 | No | n/a - process image refreshed |
| Outputs (Q) | Q 0.0 .. Q 1023.7 | No | n/a |
| Bit memory (M) | M 0.0 .. M 1023.7 | Bytes M 0 .. M 15 (16 bytes) | M 0 .. M 10239 (10 KB total) |
| Analog inputs (AI) | AI 0 .. AI 62 / AIW 64 .. AIW 1254 | No | n/a |
| Analog outputs (AQ) | AQ 0 .. AQ 62 / AQW 64 .. AQW 1254 | No | n/a |
| Data blocks (DB) | DB 1 .. project-defined (typ. 1 to 65 535) | Per-block attribute | Pooled with M in 10 KB budget |
| System memory (SM) | SM 0.0 .. SM 8x [see manual] | System-managed partial | System-controlled |
Troubleshooting Matrix
| Symptom | Likely cause | Corrective action |
|---|---|---|
| Retain column greyed-out in PLC tag table | Tag in I/Q area, know-how protect, or byte pool = 0 | Move to M area or DB-static, unset know-how write protection, enter >0 in Retain memory bytes |
| Compile error "Retentive memory area too large" | M retentive bytes + DB retentive bytes > 10 240 | Reduce one of the two budgets |
| Download error "Memory area is configured retentive, but CPU does not support it" | Target device has been swapped without re-resolving | Right-click CPU > Device > Recompile > Match Project to Target |
| Values cleared despite Retain set | Project downloaded as "Hardware only" or "Software only" | Use "Hardware and Software (full)" download to refresh remanence table |
| DB tags lost after STOP-RUN | DB Retain attribute not enabled | Open DB > Properties > Attributes > Retain = active |
| Wrong counter value after power-on | OB100 (warm restart) is initialising the field | Use retained tags only, do not reset in OB100 |
| Recipe data wiped after firmware update | Recipe directory not present on the new build | Re-export recipe DB to SD card post-update, or store in load memory explicitly |
| CPU RUN blinks ERROR | Retentive allocation on S7-1200 firmware < V4.0 misapplied | Update firmware to V4.2+ via Siemens support site before retrying |
Verification Procedure
- Online: Connect to the CPU (Online > Go online) and place the mode selector at RUN.
-
Modify: Open a Watch Table and force
%MW100to1234via "Modify now". - Power-down: Use the main breaker to drop AC supply for at least 10 seconds.
- Power-up: Restore AC supply. Wait for LED pattern RUN solid green (no MAINT/ERROR).
-
Read-back: Go online again, monitor
%MW100. Expected value1234. -
Data block equivalent: Repeat for
"RecipeDB".Counter. Both should hold value.
Best Practices and Engineering Notes
- Allocate retentive memory only for state variables: counters, totalisers, calibration offsets, setpoints. Avoid using it for transient buffers or pulse trains.
- Reserve recipes and configuration sets for the Memory Card - not for in-CPU work memory - if the machine must survive CPU swap.
- After any retentive-range change, always download Hardware and Software (full); otherwise the remanence table does not update.
- Document retentive and non-retentive regions in the program's header comment block so commissioning engineers can predict cold-restart behaviour.
- Before firmware updates, save the recipe directory to the SIMATIC Memory Card and a backup file to FAT/exFAT USB storage.
- For multi-CPU redundancy setups, recipe data on a shared Memory Card is the supported path for state synchronisation.
Related References (Siemens Documentation)
- S7-1200 Programmable Controller - System Manual
- TIA Portal Help - Setting retentive behaviour of PLC tags
- S7-1200 Application Note - Recipes via TIA Portal
- Siemens Industry Mall - 6ES7214-1AG40-0XB0 catalog entry
FAQ
Why is the Retain checkbox greyed-out in the PLC tag table for an MW tag?
The column is disabled because the project-level Retain memory byte budget is still 0. Open CPU properties > Retain memory, enter a non-zero value (e.g., 100), recompile, and the column will enable. Also confirm the tag address is in the M area, not in I/Q.
How many KB of retentive memory does the 6ES7214-1AG40-0XB0 support?
The CPU 1214C AC/DC/RLY supports up to 10 KB shared between the M retentive byte range and any retentive data blocks. Requesting more than 10 KB produces a compile error.
Does a retentive DB survive a firmware update?
No. Firmware updates reset work memory, including the retentive area. Recipes stored on the SIMATIC Memory Card (load memory) do persist if exported via the TIA Portal recipe view before the update.
What is the difference between M retentive and DB Retain?
M retentive is a contiguous byte range declared globally in CPU properties; DB Retain is a per-block attribute set inside each Data Block. Both consume the same 10 KB budget on the 1214C and are preserved through power-down.
Can I transfer retentive values to a replacement CPU?
Use the RecipeDB + recipe view to externalise values to the SIMATIC Memory Card; that file can then be loaded on a fresh CPU. Direct M-area values cannot be cloned without an export/import routine executed while the CPU is in STOP.
Which TIA Portal version first enabled the Retain tick in the PLC tag table?
The Retain attribute for PLC tags was first delivered with the S7-1500/S7-1200 support in TIA Portal V13. The S7-1200 line added full retentive work memory at firmware V4.0, supported by TIA Portal V14 SP1 and later.