S7_m_c Attribute: STEP 7 to WinCC Structure Tag Integration

David Krause12 min read
HMI / SCADASiemensTechnical 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 s7_m_c attribute (full name: S7_monitoring_control) is a STEP 7 block-interface property that controls whether a variable on a Function Block (FB) interface is automatically published to WinCC during OS compilation. When set to TRUE, the variable becomes a member of the structure tag generated in WinCC; when left at the default FALSE, the variable is excluded from the WinCC tag management generated from the S7 program.

This attribute is the central mechanism behind the STEP 7 / WinCC integrated engineering workflow in the classic PCS 7 and STEP 7 V5.x toolchain. It is set in the FB interface declaration (Input, Output, InOut, or Static sections) and is honored when the S7 program is compiled to the WinCC tag database via OS Compile.

Toolchain scope: s7_m_c is a STEP 7 V5.x attribute evaluated by the WinCC / PCS 7 OS compiler. In the TIA Portal, the equivalent behavior is controlled by the HMI tag properties in the PLC data type or the "Operator control and monitoring" visibility on the DB / PLC tag.

Attribute Definition and Default State

The s7_m_c attribute is a Boolean flag. It appears in the Attributes column of the FB / FC / DB interface editor in STEP 7. The default value is FALSE, which means the variable will not be published to WinCC unless the engineer explicitly changes the attribute on a per-pin basis.

Attribute Value Meaning WinCC Result
s7_m_c = TRUE Pin is published to WinCC Becomes a member of the structure tag (Input, Output, or InOut element of the FB's instance DB)
s7_m_c = FALSE (default) Pin is hidden from WinCC Not present in the generated structure tag; behaves as if no attribute were assigned

Per the official TIA Portal attribute documentation, attributes can be changed individually on each variable in the block interface, and the runtime meaning of each attribute is fixed by the S7 / WinCC system, not by user code. See the Siemens TIA Portal variable attributes reference for the canonical list of attributes and their meanings.

s7_m_c = TRUE Behavior

When s7_m_c = TRUE is set on an FB interface element, the following sequence occurs during OS compilation:

  1. The STEP 7 OS compiler walks the S7 program and finds every FB whose instance DB has the property Operator Control and Monitoring enabled.
  2. For each such instance DB, the compiler reads the FB interface and collects every pin where s7_m_c = TRUE.
  3. A structure tag is created in the WinCC tag management. The structure tag name matches the FB name (or the instance DB name in some configurations).
  4. Each s7_m_c = TRUE pin becomes an element of that structure tag, preserving its data type (BOOL, INT, REAL, STRING, etc.).
  5. The structure tag is read-only at the WinCC structure level: the individual elements, however, can be read and (where permitted by the access direction) written from the HMI/SCADA.

This is the workflow that the engineering community uses to keep the STEP 7 and WinCC views synchronized: define the controller logic in FBs, mark the externally relevant pins, and let the compiler generate the HMI tag database without manual point-by-point configuration.

s7_m_c = FALSE Behavior

Setting s7_m_c = FALSE (or simply leaving the attribute untouched, since FALSE is the default) has the same effect as if the attribute had never been assigned. The pin:

  • Exists in the S7 program and is used in the FB logic as normal.
  • Is not generated into the WinCC structure tag during OS compilation.
  • Is invisible to the WinCC tag management, even if the FB's instance DB is flagged for Operator Control and Monitoring.
Common confusion: The attribute is often misunderstood as controlling runtime behavior in the PLC. It does not. s7_m_c = FALSE does not disable the variable, does not affect the FB execution, and does not change any value at runtime. It is a compile-time, engineering-tool instruction to the OS compiler only.

Block Interface Requirements

Not every section of an FB interface supports s7_m_c in the same way. The official guidance from Siemens, validated by field practice, is as follows:

Interface Section s7_m_c Support Notes
Input (IN) Yes Published as a read-only WinCC element (the PLC drives the value).
Output (OUT) Yes Published as a writable WinCC element when the FB exposes an output for operator control.
InOut (IN_OUT) Yes Published as a read/write element; the WinCC structure element mirrors the S7 reference directly.
Static (STAT) Not supported in practice Setting s7_m_c on STAT does not produce a structure tag element. This is a frequent source of confusion: the attribute is silently ignored on the Static section.
Temp (TEMP) No Temporary variables are not part of the instance DB and are never published.
Function (FC) interface No FCs do not have an instance DB, so no structure tag is generated from FC pins.

The structure tag generation is triggered only on FBs (not FCs) and only when the instance DB is flagged with the Operator Control and Monitoring property in the DB's attributes dialog.

Workflow: STEP 7 to WinCC Structure Tag Integration

The end-to-end procedure to expose FB pins as a WinCC structure tag is:

  1. Design the FB in STEP 7 to encapsulate the behavior of one physical or logical sub-system (e.g., a Micromaster drive on PROFIBUS, a PID controller, a valve, a motor starter).
  2. Identify the externally relevant pins in the FB interface — those values that the operator or SCADA engineer needs to read, write, or both.
  3. Set s7_m_c = TRUE on each of those pins. Open the FB interface editor, right-click the variable row, select Object Properties, and toggle the S7_m_c attribute. Repeat for each pin.
  4. Save and compile the FB so the new attribute is included in the FB's compiled interface.
  5. Create an instance DB for the FB call site in the S7 program.
  6. Open the instance DB properties and enable Operator Control and Monitoring. This is the master switch that makes the DB participate in OS compilation.
  7. Run the OS compiler in STEP 7 (or the equivalent WinCC tag import in the OS project). The compiler walks the S7 program, finds every qualified instance DB, and creates the structure tags in WinCC.
  8. Verify in WinCC that the structure tag appears under the same name as the FB and that the expected elements are present with the correct data types.
Attribute visibility: In the FB source view, the S7_m_c attribute appears in the right-hand column of the interface table. If the column is not visible, enable it via View > Columns > S7_m_c in the LAD/FBD/ST editor.

Structure Tag Properties in WinCC

Once generated, the structure tag has the following characteristics in the WinCC tag management:

  • Name: identical to the FB name (or instance DB name, depending on the OS compiler version and the OS project configuration).
  • Data type: a structure whose elements mirror the FB interface pins that had s7_m_c = TRUE.
  • Editability at the structure level: the structure itself is read-only in WinCC — you cannot add, remove, or rename elements there. Changes must be made in STEP 7 and propagated by recompilation.
  • Editability at the element level: each element can be used in pictures, picture windows, scripts, and tag logging exactly like a normal WinCC tag.
  • Access direction: determined by the FB interface section (Input = read-only in WinCC, Output / InOut = writable, subject to any access control configured on the S7 side).

Limitations and Edge Cases

The s7_m_c mechanism has several well-documented limitations that engineers must respect in design reviews:

  • Structure elements cannot be individually transferred. The element members of a structure tag cannot be sent to the OS as standalone tags; only the structure tag as a whole is generated. If you need a single element exposed independently, you must add an additional FB pin with s7_m_c = TRUE on a flat (non-structured) variable, or reference the element from a separate DB.
  • Static section is ignored. Setting s7_m_c on a STAT variable does not produce a WinCC element. The attribute is silently ignored on STAT.
  • UDT-typed pins are published as a single structure element; their inner members are not individually exposed unless the UDT itself contains FBs with their own instance DBs flagged for Operator Control and Monitoring.
  • Renaming an FB after the OS has been compiled will break the link to the existing structure tag. The OS must be recompiled and the tag references in pictures updated.
  • Multi-project OS compilation requires that the S7 program and the WinCC OS project belong to the same STEP 7 / PCS 7 master project, or to coordinated master projects with consistent paths.

TIA Portal and Modern Toolchain Equivalents

Although the field report centers on STEP 7 V5.x, the same intent is preserved in the TIA Portal under different UI labels. The TIA Portal block-interface attribute reference documents the modern attribute set, including:

  • S7_Server / S7_a_type — used for OPC UA exposure on PLC tags.
  • S7_m_c retained for backward compatibility with classic WinCC structures.
  • HMI tag properties on the DB or PLC tag — toggle Visible in HMI to expose the tag to the HMI tag collection.

In TIA Portal, the more common path is to declare the data points in the PLC data types editor and select the HMI visibility per tag. The OS compilation step is replaced by the HMI tag import in the TIA Portal project tree.

Geo SCADA and Third-Party Driver Mapping

Third-party SCADA packages that connect to S7 PLCs — for example, Schneider Electric Geo SCADA (ClearSCADA) — do not consume the s7_m_c attribute directly. Instead, they read the S7 data blocks via the Simatic S7 driver and expose the configured points in their own tag database.

For status and quality, the Simatic S7 driver in Geo SCADA maps S7-side quality bytes to its own status attributes, as documented in the Geo SCADA Simatic S7 point status attributes reference. This is relevant when an S7 structure tag is being polled by both WinCC and a parallel SCADA: the SCADA sees the raw data block contents regardless of s7_m_c, while WinCC uses s7_m_c to know which elements belong to the WinCC tag structure.

Troubleshooting Matrix

Symptom Likely Cause Resolution
Structure tag missing in WinCC Instance DB does not have "Operator Control and Monitoring" enabled. Open the DB properties, enable the option, recompile the OS.
Pin missing from the structure tag s7_m_c not set on that pin, or attribute is on a STAT variable. Set s7_m_c = TRUE on the Input / Output / InOut pin; move logic to a non-Static section if needed.
Structure tag present but elements are wrong type FB interface was changed after the last OS compile. Recompile the S7 program and the OS; refresh the WinCC tag database.
Tag visible in WinCC but not in pictures Picture I/O field or script references the old structure name. Update picture references to the new structure name after FB rename / recompile.
Compiler error during OS compile referencing S7_m_c Attribute syntax corruption in the S7 source. Recompile the FB from source; ensure the attribute column is the canonical S7_m_c flag, not a user-defined attribute.
Structure elements not writable from WinCC Pin is on the FB Input section (read-only by design). Move the variable to Output or InOut, or expose an explicit Output pin for the operator-controlled value.

Best Practices

  • Design FBs around physical or logical sub-systems (one drive, one valve, one controller loop) so the resulting structure tag is reusable across multiple instance DBs in the S7 program.
  • Reserve s7_m_c = TRUE for operator-relevant pins only. Marking every internal calculation or intermediate value bloats the WinCC tag database and slows the OS startup.
  • Document the attribute decisions in the FB header (revision comment) so the next engineer knows which pins are intentionally exposed.
  • Use InOut sparingly for operator control. InOut pins are reference-passed and can be written from WinCC; if the FB needs to validate the written value, an Output pin with a write-back Input (or a custom command interface) is safer.
  • Recompile the OS after every FB interface change, even if the change appears minor. Attribute edits in STEP 7 are not visible to WinCC until the OS compiler runs.
  • Validate the generated structure tag in WinCC before starting HMI screen design, to catch missing or mistyped pins early.

Verification Checklist

  1. FB source shows s7_m_c = TRUE on the expected Input / Output / InOut pins.
  2. FB is recompiled and downloaded to the PLC (or queued for download).
  3. Instance DB exists and has Operator Control and Monitoring enabled in its properties.
  4. OS compile completes without warnings related to the structure tag.
  5. WinCC tag management shows the structure tag with the FB name and the expected element list.
  6. Each element appears with the correct data type (BOOL, INT, REAL, STRING, etc.).
  7. Test picture with I/O fields bound to the structure elements reads / writes correctly online.

What does s7_m_c = FALSE mean for a structure tag in STEP 7?

It means the pin is excluded from the WinCC structure tag generated by the OS compiler. The pin still functions normally in the S7 program; the attribute only affects whether WinCC sees it. Setting s7_m_c = FALSE has the same effect as leaving the attribute at its default value.

Why are the elements of an S7 structure or UDT not individually transferred to WinCC?

The OS compiler only generates the top-level structure tag. Its inner members cannot be promoted to standalone WinCC tags. To expose a single value, add a dedicated Input / Output / InOut pin on the FB with s7_m_c = TRUE, or reference the value from a separate non-structured DB.

Does s7_m_c work on the Static section of an FB?

No. Setting s7_m_c on a Static (STAT) variable is silently ignored by the OS compiler. Use the Input, Output, or InOut sections for pins you want to publish to WinCC.

Is the structure tag read-only in WinCC?

The structure itself is read-only — you cannot edit its members or data types in WinCC. The individual elements, however, are read/write according to the FB interface section: Input elements are read-only, Output and InOut elements are writable, subject to any access control configured on the S7 side.

Does s7_m_c apply in TIA Portal as well as STEP 7 V5.x?

Yes, the attribute is retained in the TIA Portal for backward compatibility. The more common modern path is to toggle HMI tag visibility on the PLC data type or the DB tag in the TIA Portal project tree, which performs the same role for the integrated HMI compilation.

Back to blog