Exposing S7 Data Block Variables to WinCC in SIMATIC PCS 7 via the S7_m_c Attribute
In SIMATIC PCS 7, displaying variables from a standalone S7 Data Block (such as a shared DB populated by SFB14 'GET' or custom communication routines) on WinCC without utilizing Continuous Function Chart (CFC) blocks is achieved using the 'S7_m_c' (Operator Control and Monitoring) system attribute. To expose DB tags to WinCC, the engineer must assign the attribute 'S7_m_c := true' to the Data Block object properties, and assign 'S7_m_c := true' individually to each desired variable within the DB declaration table. Upon executing an OS Compilation, the compiler automatically generates corresponding WinCC runtime tags within the AS-OS Named Connections tag pool, making them immediately accessible for display in WinCC screens.
Table of Contents
- The Role of S7_m_c in the PCS 7 Engineering Philosophy
- Supported Data Types for S7_m_c Tag Compilation
- Step-by-Step Procedure: Exposing Shared DB Variables to WinCC
- CFC Block Creation vs Standalone DB Architecture
- Comparative Matrix: Data Visualization Methods in PCS 7
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
The Role of S7_m_c in the PCS 7 Engineering Philosophy
In standard SIMATIC PCS 7 engineering, human-machine interface (HMI) generation is automated:
- Engineers place technological blocks in CFC charts (e.g., MotL, PIDConL).
- The compiler automatically creates WinCC tags, alarms, and block icons during OS Compilation.
However, when integrating legacy controllers, third-party systems via communications blocks (SFB14 GET / SFB15 PUT), or complex mathematical arrays, data frequently resides in raw S7 Data Blocks (DBs) rather than CFC chart instances.
To bridge raw DB variables into WinCC without manually typing tag names in WinCC Tag Management:
- The system attribute S7_m_c (SIMATIC 7 Monitoring and Control) acts as an automated compiler flag.
- When placed on a DB and its internal variables, the AS-OS compiler treats the DB as an official process object, compiling the variables into WinCC tags automatically.
Supported Data Types for S7_m_c Tag Compilation
The PCS 7 AS-OS compiler strictly validates variable data types when evaluating S7_m_c:
- Supported Elementary Types:
- BOOL -> Binary Tag
- BYTE -> Unsigned 8-bit value
- CHAR -> 8-bit character
- INT -> Signed 16-bit value
- DINT -> Signed 32-bit value
- WORD -> Unsigned 16-bit value
- DWORD -> Unsigned 32-bit value
- REAL -> Floating-point 32-bit IEEE 754
- STRING -> Text tag (8-bit character set)
- Unsupported Types: ANY, POINTER, TIMER, COUNTER, complex nested multidimensional arrays (unless individual elements are tagged).
Step-by-Step Procedure: Exposing Shared DB Variables to WinCC
Follow this procedure in SIMATIC Manager:
Step 1: Assign S7_m_c to the Data Block
- In SIMATIC Manager, navigate to
[AS Station] > [CPU Object] > S7 Program > Blocks. - Right-click the target Data Block (e.g.,
DB100) and select Object Properties. - Switch to the Attributes tab.
- In the table:
- Attribute: EnterS7_m_c(ensure capital 'S' and exact casing).
- Value: Entertrue. - Click OK. The DB icon in the block folder will display a small green hand symbol, indicating OCM capability.
Step 2: Assign S7_m_c to Individual Variables
- Double-click
DB100to open the DB in the declaration view. - Select the specific variable row (e.g.,
Temperature_Tank1). - Right-click the variable row and select Object Properties.
- In the Attributes tab, add:
- Attribute:S7_m_c
- Value:true - Repeat for all variables intended for HMI display. Save the DB.
Step 3: Compile the OS
- In SIMATIC Manager, right-click the OS project and select Compile.
- Select the target AS station and choose Changes only.
- The compiler extracts the tagged DB variables and creates WinCC tags under the connection:
Named Connections > [Connection_Name] > DB100_Temperature_Tank1.
Step 4: Display on WinCC Process Screens
- In Graphics Designer, insert an I/O Field or Static Text.
- In the dynamic tag browser, browse to
Named Connections > DB100. - Link the tag directly to display live process data in runtime.
CFC Block Creation vs Standalone DB Architecture
While exposing DB variables via S7_m_c is fully supported, engineers should understand the trade-offs:
- CFC APL Style (Best Practice): Creates standardized block icons, alarm messages, faceplates, and supports delta download in RUN without DB address shifts.
- Standalone DB (S7_m_c): Requires manual creation of WinCC graphic displays; adding a variable in the middle of the DB shifts byte offsets, requiring full OS recompilation and careful address coordination.
Comparative Matrix: Data Visualization Methods in PCS 7
The table below compares methods for visualizing PLC variables in WinCC:
Verification
To confirm that the DB variables compiled successfully:
1. WinCC Tag Management Check: In WinCC Explorer, open Tag Management; expand Named Connections; verify that tags corresponding to DB100 are listed with valid data types.
2. Runtime Value Inspection: Activate WinCC Runtime; open the screen containing the linked I/O field; verify that the numeric value matches the online value in DB100 in STEP 7.
3. Quality Status Verification: Confirm that the WinCC tag displays normal quality without yellow exclamation marks.
Limitations and Operational Precautions
Engineering teams must observe the following precautions:
- Attribute casing is strictly enforced: typing s7_m_c (lowercase) will cause the compiler to silently ignore the tag; it MUST be S7_m_c.
- Inserting or deleting variables inside an existing data block changes downstream byte offsets; always perform an OS compilation immediately following DB modifications to prevent WinCC from reading corrupted memory addresses.
- DB variables compiled into WinCC consume standard WinCC OS Runtime tags / Process Objects.
Engineer FAQ
Can I assign S7_m_c directly in S7-SCL source code?
Yes. In SCL, declare the attribute above the variable: VAR Temperature_Tank1 { S7_m_c := 'true' } : REAL; END_VAR.
Why is my DB tag missing from WinCC after OS compilation?
Confirm that S7_m_c := true was assigned to BOTH the DB object properties AND the individual variable declaration line, and that the AS-OS connection is active in NetPro.
Can I assign alarm attributes (S7_alarm) to standalone DB tags?
No. Message generation via OS compilation requires calling message blocks (ALARM_8P / NOTIFY_8P) inside CFC or SCL; raw DB tags cannot generate automated WinCC alarm logging messages.
Technical References
- SIMATIC PCS 7 Operator Station Engineering Manual (A5E36987024)
- SIMATIC STEP 7 V5.5 Programming Manual (A5E00706960)
- Siemens Support: Using S7_m_c Attributes on DB Variables (Entry ID: 109740190)
Related Articles
- Configuring SCL Attributes and WinCC Block Icons for Custom Technological Blocks
- Archiving STRING Data Types in SIMATIC PCS 7 - S7_archive Limitations and Alternative Storage Solutions
- Configuring AS-OS Communication and Redundant WinCC Servers in SIMATIC PCS 7
Related Tags
- S7_m_c
- Data Blocks
- OS Compilation
- Tag Management
- WinCC Visualization