Exposing S7 Data Block Variables to WinCC in SIMATIC PCS 7 via the S7_m_c Attribute

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

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

  1. In SIMATIC Manager, navigate to [AS Station] > [CPU Object] > S7 Program > Blocks.
  2. Right-click the target Data Block (e.g., DB100) and select Object Properties.
  3. Switch to the Attributes tab.
  4. In the table:
    - Attribute: Enter S7_m_c (ensure capital 'S' and exact casing).
    - Value: Enter true.
  5. 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

  1. Double-click DB100 to open the DB in the declaration view.
  2. Select the specific variable row (e.g., Temperature_Tank1).
  3. Right-click the variable row and select Object Properties.
  4. In the Attributes tab, add:
    - Attribute: S7_m_c
    - Value: true
  5. Repeat for all variables intended for HMI display. Save the DB.

Step 3: Compile the OS

  1. In SIMATIC Manager, right-click the OS project and select Compile.
  2. Select the target AS station and choose Changes only.
  3. 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

  1. In Graphics Designer, insert an I/O Field or Static Text.
  2. In the dynamic tag browser, browse to Named Connections > DB100.
  3. 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:

Visualization MethodConfiguration LayerAutomatic Tag CreationFaceplate SupportEngineering EffortCFC APL BlocksCFC EditorFully AutomatedStandard APL FaceplatesLow (Turnkey)Data Block with S7_m_cSTEP 7 DB EditorFully Automated via CompileCustom Graphics RequiredModerateManual WinCC TaggingWinCC Tag ManagementNone (Manual Entry)Custom Graphics RequiredHigh (Error-prone)

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

Related Articles

Related Tags

  • S7_m_c
  • Data Blocks
  • OS Compilation
  • Tag Management
  • WinCC Visualization
6 respuestas