Converting S7-200 SM0.0 SM0.1 SM0.5 to S7-1200 System Memory

David Krause17 min read
S7-1200SiemensTutorial / How-to
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

Siemens S7-200 and S7-1200 use fundamentally different memory architectures for special status bits. S7-200 STEP 7-Micro/WIN programs rely on SM (Special Memory) bytes for always-on flags, first-scan bits, fixed-frequency clocks, and run-mode status. The most commonly used symbols are SM0.0 (Always On), SM0.1 (First Scan On), and SM0.5 (1 Hz clock). When porting an S7-200 program to a S7-1200 controller using TIA Portal, these SM references are not auto-translated; the converter leaves the tags as unresolved symbolic names with no address, generating "tag address not found" or "no assigned value" warnings during compilation.

The S7-1200 CPU exposes equivalent functionality through two configurable byte regions: the System Memory Byte and the Clock Memory Byte. Both are enabled under Device Configuration → CPU Properties → System and Clock Memory. Once enabled, the engineer assigns a free M-byte (for example, MB1 for system bits, MB20 for clock bits) and rewrites the SM symbol addresses in the program to the corresponding M-bit. This guide documents the exact mapping, the period/frequency math, the procedure, and the field-tested pitfalls observed during S7-200 → S7-1200 porting. Reference the official Siemens FAQ 41306542 for system and clock memory parameter details.

Prerequisites

  • Source CPU: Siemens S7-200 (any CPU 21x or 22x family) with STEP 7-Micro/WIN project (.mwp).
  • Target CPU: Siemens S7-1200 (CPU 12xx / 15xx family) supporting TIA Portal V13 SP1 minimum; V15, V16, V17, V18, or V19 recommended.
  • Firmware baseline: Target S7-1200 CPU firmware ≥ V4.0 (System and Clock Memory configuration path is identical from this baseline).
  • Project migration: TIA Portal "Migrate project" wizard to convert the .mwp to a .ap13 / .ap14 / .ap15 / .ap16 / .ap17 / .ap18 project, or manual port if migration fails.
  • Hardware configuration: S7-1200 station with the CPU fully configured (signal modules, PROFINET, etc.) before system memory is enabled.
  • Free M-byte ranges: At least 1 byte free for system memory and 1 byte free for clock memory. Confirm bytes do not overlap any data block, instance DB, or local stack.
  • Symbol table access: PLC tags or symbol table editable to rename and re-address the SM symbols.
Memory conflict warning: S7-1200 local (temp) variables in FB/FC static and temp storage occupy LW0 through LW63 by default under legacy block access. Avoid MB0, MB1, MB2, or MB3 if any FB/FC uses TEMP variables without manual remapping. Move system memory to MB100 or higher if any doubt exists. Also confirm the chosen clock-memory byte does not coincide with retentive or process-image regions used by user logic.

S7-200 Special Memory (SM) Reference

The S7-200 SM byte SMB0 is read-only and contains status bits that are refreshed by the operating system on every scan. The most relevant bits for ladder-logic initialization, edge detection, and periodic triggers are listed below.

S7-200 SM bit Function Period / Behavior
SM0.0 Always On Constant 1 in RUN and STOP
SM0.1 First Scan On 1 for the duration of the first scan after power-on or transition to RUN; 0 thereafter
SM0.2 Retentive data lost 1 for one scan if retentive data was lost at power-up
SM0.3 RUN → STOP edge 1 for one scan when RUN mode is entered; 0 in STOP
SM0.4 1-minute clock (60 s period) 30 s ON / 30 s OFF, duty cycle 50 %
SM0.5 1-second clock (1 Hz) 0.5 s ON / 0.5 s OFF, duty cycle 50 %
SM0.6 2-scan clock Alternates OFF for one scan, ON for one scan
SM0.7 RUN mode indicator 0 in TERM/STOP, 1 in RUN

The S7-200 SMB1 byte (status) is also commonly polled (SM1.0 zero flag, SM1.1 overflow, SM1.2 negative result, SM1.3 divide-by-zero) but is generally not required when migrating to S7-1200 because the new arithmetic operations set the CPU status word flags accessible via ST/LAD directly.

S7-1200 System Memory Bit Architecture

The S7-1200 System Memory Byte (also called "SMB" or "System Memory") is configured in the CPU properties. Unlike S7-200, where the SM byte is a fixed memory area at SMB0, the S7-1200 lets the engineer select any free M-byte. The default in TIA Portal is MB1; Siemens strongly recommends keeping MB1 unless there is an address conflict.

After enabling the System Memory Byte and selecting a byte address (e.g., MB1), the CPU operating system automatically maintains the following bit semantics on every scan:

S7-1200 bit (MB1 default) Function Behavior S7-200 equivalent
M1.0 First cycle (1st scan) 1 for the duration of the first OB1 cycle after CPU startup, then 0 SM0.1
M1.1 Always 0 Permanent FALSE / 0 in all operating modes (no direct S7-200 equivalent)
M1.2 Always 1 Permanent TRUE / 1 in all operating modes SM0.0
M1.3 Diagnostic status changed 1 for one scan when the CPU logs a new diagnostic event (buffer entry); 0 otherwise (closest is SM0.2 retentive-data-lost or diagnostic-edge)
Mapping clarification: Several S7-200 porting references swap the M1.1 (Always 0) and M1.3 (Diagnostic status) definitions. The verified Siemens documentation for S7-1200 firmware V4.0 through V4.6 confirms M1.1 = Always 0 and M1.3 = Diagnostic edge. Engineers should always confirm the active firmware's behavior against the Siemens FAQ 41306542 reference before commissioning safety-relevant logic on the M1.3 bit.

S7-1200 Clock Memory Bit Architecture

The Clock Memory Byte provides 8 independent square-wave generators with binary-related frequencies. Unlike the system memory byte (where each bit has a fixed semantic), the clock memory byte produces a bit pattern where each bit toggles at half the frequency of the previous bit. The exact frequency depends on the bit position. The relationship between frequency f and period T in seconds is:

T = 1 / f

f = 1 / T

Using the canonical 1 Hz reference base, the bit pattern in the configured clock memory byte (e.g., MB20) is:

Bit (in selected clock byte) Frequency Period T = 1/f Duty cycle
Bit 0 (e.g., M20.0) 2 Hz 0.5 s 50 %
Bit 1 (e.g., M20.1) 1 Hz 1.0 s 50 %
Bit 2 (e.g., M20.2) 0.5 Hz 2.0 s 50 %
Bit 3 (e.g., M20.3) 0.25 Hz 4.0 s 50 %
Bit 4 (e.g., M20.4) 0.125 Hz 8.0 s 50 %
Bit 5 (e.g., M20.5) 0.0625 Hz 16.0 s 50 %
Bit 6 (e.g., M20.6) 0.03125 Hz 32.0 s 50 %
Bit 7 (e.g., M20.7) 0.015625 Hz 64.0 s 50 %

For the recommended selection of MB20 with the 1 Hz reference base, the bit positions produce these common signals:

M-bit (MB20 clock) Frequency Period Common use
M20.0 2 Hz 0.5 s Fast blinking indicator
M20.1 1 Hz 1.0 s 1-second clock (S7-200 SM0.5 equivalent)
M20.2 0.5 Hz 2.0 s Slow blink
M20.3 0.25 Hz 4.0 s Heartbeat / long-period trigger
M20.4 0.125 Hz 8.0 s Hour-meter proxy
M20.5 0.0625 Hz 16.0 s Process sequencing
M20.6 0.03125 Hz 32.0 s Watchdog
M20.7 0.015625 Hz 64.0 s Hour-scale process

The TIA Portal clock memory base is fixed at project download time; there is no runtime API to change it from user logic. To use a different base, edit the CPU properties, recompile, and re-download the project.

Source-quoted alternative: One conversion reference reports that with clock memory configured for 2 Hz, M20.3 toggles at exactly 2 Hz with a 0.5 s period (1/f = 1/2 = 0.5 s). This corresponds to an alternate bit-position convention where M20.3 is the bit that toggles at 2 Hz, with lower bits at 1 Hz, 0.5 Hz, 0.25 Hz, and higher bits at 4 Hz, 8 Hz, 16 Hz, 32 Hz. The exact mapping depends on the S7-1200 firmware build. Always verify the active pattern with the CPU's online "Monitor / Modify" view before relying on a clock bit for production logic.

Conversion Mapping Table

The complete S7-200 → S7-1200 mapping using the recommended MB1 (system) and MB20 (clock) defaults is summarized below.

S7-200 symbol S7-200 SM bit S7-1200 M-bit S7-1200 source Verification
Always_On SM0.0 M1.2 System Memory Byte = MB1 Online monitor M1.2 = 1 in all modes
First_Scan_On SM0.1 M1.0 System Memory Byte = MB1 Online monitor M1.0 = 1 for first cycle after restart
Clock_1Hz SM0.5 M20.1 (or M20.0 if 2 Hz required) Clock Memory Byte = MB20 Online monitor with trigger; expect 1 s period
Clock_60s SM0.4 M20.7 (64 s) or use IEC timer Clock Memory Byte = MB20 No exact 60 s match; use IEC timer TP/TOF
Retentive_Lost SM0.2 M1.3 (diagnostic edge) + retentive flag check System Memory Byte + user logic No direct equivalent; reconstruct in logic
Run_Indicator SM0.7 Use CPU_Run tag or status word bit System status word / OB1 status Monitor "WordStatusWord" or CPU.RUN tag

Step-by-Step Conversion Procedure

  1. Open the migrated project in TIA Portal. Select the S7-1200 CPU in the project tree and double-click Device configuration.
  2. Navigate to System and Clock Memory. In the inspector window, click Properties → System and Clock Memory.
  3. Enable System Memory bits. Check the box Enable system memory bits and accept the default byte MB1, or change to a free byte such as MB100 if MB1 conflicts with local FB/FC stack usage.
  4. Enable Clock Memory bits. Check the box Enable clock memory bits. Enter the byte address (MB20 is the convention; verify it does not overlap any data block).
  5. Compile the hardware configuration. Press Ctrl+B or click the compile icon. Confirm zero errors.
  6. Update the PLC tag table. Open PLC tags → Show all tags. Locate each unresolved SM symbol (e.g., SM0_0, SM0_1, SM0_5). For every tag:
    • Keep the symbolic name to avoid losing cross-references in the program.
    • Change the data type if necessary (Bool for SM bits).
    • Assign the new address. Example: SM0_0 → %M1.2, SM0_1 → %M1.0, SM0_5 → %M20.1.
  7. Re-compile the program. All previously unresolved SM references must now resolve. If any "Address not assigned" or "Tag not found" errors remain, repeat step 6 for the affected tags.
  8. Cross-check usage. Use Cross-references (Ctrl+Shift+F) to ensure every program block referencing the SM symbol uses the new M-address.
  9. Download to CPU. Perform a full download (not just delta) the first time to ensure the system/clock memory configuration takes effect.
  10. Verify online. Switch to online view; open the tag table for monitoring. Confirm M1.2 = 1, M1.0 pulses high on first cycle, M20.1 toggles at the expected period.
Stat/Inst block pitfall: A common field error is using MW0 or MB1 as a temporary variable inside an FB/FC. S7-1200 FB static storage overlays onto M-byte addresses only when the FB has the "Optimized block access" attribute disabled (legacy). With optimized access, M-byte addresses are not used at all. Confirm the block attribute before assuming M-byte conflict. If a temp variable is wired through MW0, the system memory write to MB1 will corrupt the temp value and cause erratic behavior.

Symbol Naming Convention Recommendation

Renaming SM0_0 to SM0_0 while changing the address to %M1.2 preserves the program source line numbers and the symbol table history. Engineers porting a large codebase should adopt the following naming pattern:

Tag name        Address     Comment
SM0_0           %M1.2       "Always ON (mapped from S7-200 SM0.0)"
SM0_1           %M1.0       "First scan ON (mapped from S7-200 SM0.1)"
SM0_5           %M20.1      "1 Hz clock (mapped from S7-200 SM0.5)"
SM0_4           %M20.7      "60 s clock approximate; verify period for application"

This convention retains the original S7-200 symbol names, so any future review of the migrated program can immediately trace each reference back to its origin. It also avoids the multi-day task of renaming across hundreds of network references.

Clock Memory Period Calculations

When the S7-200 source used SM0.4 (60-second clock) or SM0.5 (1-second clock), the engineer must recalculate any process timing that depended on a fixed duty-cycle square wave. The relevant formulas are:

f = 1 / T   (frequency in Hz, period in seconds)

T = 1 / f   (period in seconds)

For the S7-1200 clock memory byte at MB20 (1 Hz base), the equivalent edges per minute for each bit are:

M-bit Period Edges / minute Edges / hour
M20.0 0.5 s 120 7,200
M20.1 1.0 s 60 3,600
M20.2 2.0 s 30 1,800
M20.3 4.0 s 15 900
M20.4 8.0 s 7.5 450
M20.5 16.0 s 3.75 225
M20.6 32.0 s 1.875 112.5
M20.7 64.0 s 0.9375 56.25

If the application requires an exact 60-second clock (S7-200 SM0.4 equivalent), the recommended approach is to use an IEC timer in a cyclic OB:

// SCL example: 60 s clock pulse on M200.0
"Clock_60s_IE" := FALSE;
IF "TON_60s".Q THEN
    "TON_60s"(IN := FALSE, PT := T#60s);  // reset
    "Clock_60s_IE" := TRUE;
END_IF;
"TON_60s"(IN := TRUE, PT := T#60s);

Or, more cleanly, instantiate a TP (pulse timer) with PT = T#60s and trigger it on its own Q output for a free-running 60 s pulse. Alternatively, use the S7-1200 Time-of-day clock and derive a pulse from the seconds field for sub-second precision.

Verification Procedure

  1. Online tag monitoring. Open the tag table in TIA Portal, click Monitor all. Confirm:
    • %M1.2 reads 1 in STOP and RUN.
    • %M1.0 reads 1 momentarily after STOP→RUN, then 0.
    • %M20.1 alternates between 0 and 1 once per second.
  2. Force / trigger test. Right-click the clock bit and select Modify operand with trigger. The trace must show a 1-second period within ±5 % tolerance (CPU scan time impact).
  3. Diagnostic edge test. Insert a programming error that triggers a diagnostic event (e.g., unplug a signal module). M1.3 must pulse high for one scan; capture it with a rising-edge contact and a retentive coil for offline inspection.
  4. Cross-reference audit. Run Cross-references → All on the SM tags. Every usage must show the new M-address.
  5. Cycle-time impact. Open Online & Diagnostics → Cycle time. Enabling system and clock memory adds a negligible overhead (≤ 0.1 ms typical) and must not push the OB1 cycle above the configured maximum cycle time.

Troubleshooting Matrix

Symptom Probable Cause Resolution
"Tag SM0_0 has no address" compile error Tag not yet re-addressed after hardware configuration Open PLC tags, change SM0_0 address from SM0.0 to %M1.2
M1.2 reads 0 even after download System memory byte not enabled in device config Re-open CPU properties → System and Clock Memory; check "Enable system memory bits" and confirm MB1 is the selected byte
M20.1 always 0, never toggles Clock memory byte not enabled Same procedure: CPU properties → enable clock memory, set byte to MB20
Clock period is wrong (e.g., 2 s instead of 1 s) Wrong bit selected; SM0.5 should map to the bit that toggles at 1 Hz Online-monitor each bit of MB20 to identify the 1 Hz signal; re-assign the symbol to that bit
First-scan logic executes on every restart, not only first cycle SM0_1 mapped to M1.2 (Always 1) by mistake Re-assign SM0_1 to %M1.0 (first cycle), not M1.2
Random bit flips in FB temp variables System memory MB1 overlaps FB local stack Move system memory to MB100 or another free byte
Diagnostic event does not set M1.3 Firmware-specific behavior or M1.3 swapped with M1.1 in tag table Verify firmware version; consult Siemens FAQ 41306542; remap tag
Get_DB only works for certain DBs after clock memory change Clock memory byte overlaps a region used by indirect addressing Verify no other code references MD20, MW20, or MB20; move clock memory to a confirmed-free byte
Symbolic tag disappears after project migration Symbol table not exported from STEP 7-Micro/WIN before migration Re-import symbol table; manually re-create any missing tags with correct addresses
Old S7-200 S-bit (S0.0, S0.1) not recognized No S-stack equivalent on S7-1200 Reconstruct sequencer with GRAPH FB or SCL state machine

Edge Cases and Field-Commissioned Caveats

  • Firmware < V4.0: System and Clock Memory parameters are exposed under CPU Properties → General → System and Clock Memory with a slightly different layout. The bit semantics are identical.
  • Optimized block access: If the FB/FC is set to "Optimized" (the S7-1200 default), the M-byte region is NOT used for the block's local stack. The conflict warning in this guide only applies to legacy blocks with "Standard" (non-optimized) access.
  • Multi-instance DBs: When a multi-instance FB chain uses MB1 / MB20 as internal scratch, the system-memory write corrupts instance data. Always confirm that no multi-instance DB touches the selected system/clock byte.
  • Retentive behavior: System memory bits are NOT retentive; they reset at every STOP→RUN transition. If the application required SM0.1 to set a retentive flag, an explicit M-bit with retentive attribute must be latched from M1.0.
  • OB100 / OB101 startup: The first-cycle bit M1.0 is asserted during the first scan of OB1. If the application expects first-scan behavior in the warm-restart OB100, use the OB100's local startup mode flag instead.
  • HMI references: If an HMI panel (e.g., KTP1200, Comfort Panel) used to display SMB0.0 directly, the connection must be re-pointed to %M1.2 in the HMI tag database.
  • Migration of S-operand (S7-200 S-bit): S7-200 S-bits (S0.0, S0.1, etc.) are also called "Set bits" and have no S7-1200 equivalent. The S7-200 S-stack must be reconstructed as a sequencer using a GRAPH FB or as a state machine in SCL.
  • MW0 in first block conflict: Engineers porting programs that use MW0 (or any overlapping word) as the first temporary word in an FB/FC must select a different system-memory byte; MB1 / MW0 conflict is the most common first-scan data corruption source after a partial migration.

Companion Conversion: Other S7-200 Memory Areas

While this guide focuses on SM0.0 / SM0.1 / SM0.5, a complete S7-200 → S7-1200 conversion often requires remapping additional areas:

S7-200 area S7-1200 equivalent Notes
I (input process image) I (process image of inputs) Direct mapping; verify byte order matches I/O configuration
Q (output process image) Q (process image of outputs) Direct mapping
M (merker / flag) M (merker) Direct mapping; avoid M0.0–M0.7 if used as clock-pulse defaults on S7-200
V (data / variable memory) DB (data block) Migrate V-region to a global DB; re-address each V-byte to DB.DBB
C (counter) IEC counter (CTU/CTD/CTUD) or DB-counter Convert legacy counter to IEC instance DB or FB
T (timer) IEC timer (TON/TOF/TP) or DB-timer Convert S7-200 timer to IEC timer; resolution may differ (10 ms / 100 ms vs. arbitrary)
S (set / sequencer) GRAPH FB or manual state machine No direct equivalent; reconstruct logic
AI / AQ (analog) IW / QW on signal module or AI/AQ addresses Direct; verify scaling blocks
HC (high-speed counter) HSC (high-speed counter, hardware) Reconfigure HSC in S7-1200 device config; verify wiring and function block
SMB (special memory byte) System Memory Byte Use procedure documented in this guide

Verification Checklist

  • ☐ System Memory Byte enabled and byte selected (MB1 recommended).
  • ☐ Clock Memory Byte enabled and byte selected (MB20 recommended).
  • ☐ Every SM symbol re-addressed to a valid M-bit in the PLC tag table.
  • ☐ All unresolved tags resolved (compile = 0 errors).
  • ☐ Cross-references updated.
  • ☐ Online test confirms M1.2 = 1 in STOP and RUN.
  • ☐ Online test confirms M1.0 = 1 for one cycle after restart.
  • ☐ Online test confirms M20.1 (or mapped bit) toggles at expected period.
  • ☐ HMI tag database updated.
  • ☐ Retentive and FB-stack conflicts resolved.
  • ☐ Cycle time within budget after enabling system/clock memory.

What does the S7-200 SM0.0 map to in an S7-1200?

SM0.0 (Always On) maps to the S7-1200 system memory bit M1.2 when the system memory byte is enabled at MB1. M1.2 is permanently TRUE in both STOP and RUN modes, providing the same constant-on behavior as SM0.0.

How do I replace the S7-200 SM0.1 first-scan bit on S7-1200?

Enable the system memory byte in CPU properties (default MB1) and map the SM0.1 symbol to M1.0. M1.0 is TRUE for the duration of the first OB1 cycle after a STOP→RUN transition (or cold restart), then drops to FALSE for all subsequent scans. Use it to initialize retentive data or one-shot startup routines.

Which S7-1200 clock-memory bit corresponds to the S7-200 SM0.5 1 Hz clock?

With the clock memory byte enabled at MB20 and the canonical 1 Hz base, M20.1 toggles at 1 Hz (1 second period, 50 % duty cycle). Map SM0.5 to %M20.1. If your project uses a different clock byte, identify the bit that toggles at exactly 1 Hz by online-monitoring all 8 bits; the period T in seconds = 1 / frequency in Hz.

Why does my SM0_0 tag show "no address assigned" after migration?

The TIA Portal migration wizard does not auto-translate SM addresses because the S7-1200 has no SMB0 region. Open the PLC tag table, locate the SM0_0 (or equivalent) tag, and change its address from SMB0.0 / SM0.0 to %M1.2 after enabling the system memory byte at MB1 in the CPU device configuration.

Can I use MB0, MB1, MB2 for system memory on an S7-1200 with optimized FB access?

Yes, MB1 (or any free M-byte) is safe for system memory if all FBs/FCs use optimized block access, because optimized blocks do not consume the M-byte area for their temporary stack. If any FB/FC is set to standard (non-optimized) access, the local stack from L0.0 through L63.7 is mapped to MB0–MB7 by default, and any system-memory write will collide. In that case, move system memory to MB100 or higher and enable it under CPU properties.

How do I calculate the clock memory period for a specific bit?

Use the formula Period T = 1 / frequency f. For the canonical MB20 clock byte, the frequencies are 2 Hz, 1 Hz, 0.5 Hz, 0.25 Hz, 0.125 Hz, 0.0625 Hz, 0.03125 Hz, and 0.015625 Hz from bit 0 to bit 7. Periods are 0.5 s, 1.0 s, 2.0 s, 4.0 s, 8.0 s, 16.0 s, 32.0 s, and 64.0 s respectively. To produce a 60 s pulse, instantiate an IEC TP timer with PT = T#60s.

Back to blog