Explainer
Reading raw PLC tags as diagnostics in WinCC over OPC
Short answer
No. An OPC server does not limit WinCC to slave diagnostics: WinCC reads every item the server publishes, process tags included. A raw tag is only an undecoded value — match its type to the server item, decode packed words at the tag level, and drive configured alarms and displays instead of C scripts in each graphic object.
On this page
- Does an OPC server limit WinCC to slave diagnostics?
- What is a raw tag, and why is the number useless on its own?
- How do you turn a raw diagnostic word into readable text?
- How do you show diagnostics without a C script in every object?
- Why does an imported OPC tag sit at zero or show a question mark?
- How do you verify each layer from PLC to screen?
- When is OPC the wrong layer for what you need?
- Questions asked
No. An OPC server does not confine WinCC to slave diagnostics: WinCC, as the OPC client, reads every item the server publishes, and that list can include device health, diagnostic registers and full process data alike. What you imported are raw tags — values transferred without interpretation. The maintainable route is to confirm each tag's type against the server item, decode packed status words once at the tag level, and let configured alarms and normal displays present the result, keeping C scripts for transformations the configuration cannot express. This article walks that path layer by layer, with a worked decode and the checks that prove each hop.
Does an OPC server limit WinCC to slave diagnostics? #
No. The protocol carries whatever the server publishes, so the ceiling on your diagnostics is the server's item list and the PLC connection behind it — process tags and slave status ride the same WinCC tag.
WinCC sits in the OPC client role: it browses and reads the items the server offers. The server — the PLC's own communication interface, a gateway, or a separate PC server — decides what exists to read, and the PLC model, its driver and the server configuration decide whether diagnostic registers, device status and application tags are all in that list. Before anything else, be certain about who serves and who asks: which direction the OPC server and client roles work settles that question for an OPC UA setup.
Two different requirements hide behind the word diagnostics:
| Requirement | Data that decides it | WinCC presentation |
|---|---|---|
| Device or slave condition | PLC health, link status, diagnostic registers the driver or slave exposes | status indicator, diagnostic text, alarm |
| Process activity | application tags: permissives, sequence states, measurements, feedback | process screen, trend, alarm |
Both classes travel identically over OPC. A slave diagnostic describes the device or the link; it says nothing about what the process is doing, and that answer comes from the application tags the PLC programmer already maintains.
What is a raw tag, and why is the number useless on its own? #
A raw tag is a value delivered without interpretation: the number in WinCC is correct, but its data type, scale and meaning live in the PLC documentation, so the gap is decoding, not acquisition.
Classify every imported tag before you touch a screen:
- Boolean — 1 bit, one state.
- Integer code or counter — a number whose meaning is a lookup.
- Measurement — a number with a documented raw range and engineering unit.
- Packed status word — a Word (16 bits) or Double Word (32 bits) carrying several fields at once.
The external tag's type must match the server item's type. A mismatch fails quietly: values look plausible and are wrong. Why an HMI counter jumps from 9 to 16 is the classic case — a BCD value read as plain binary.
How do you turn a raw diagnostic word into readable text? #
Take the bit layout from the PLC documentation and decode once at the tag level: a Word splits into named bits and fields with fixed masks, and alarms or text lists carry the meaning.
Worked example, on an illustrative layout — substitute the layout your PLC actually documents. The tag is a Word with bit 15 as link active, bits 8 to 11 as station number (0 to 15), and bits 0 to 7 as diagnostic code (0 to 255). The tag reads 33553.
33553 = 32768 + 768 + 17, therefore:
- link: 33553 AND 32768 = 32768, so bit 15 is set and the link is active
- station: 33553 / 256 = 131 remainder 17, and 131 AND 15 = 3
- code: 33553 AND 255 = 17
The alarm then fires on any code other than 0, with the text the documented code table gives for 17, and station 3 names the device. Do this arithmetic once — in tag settings, bit monitoring or internal tags — not in every object that displays the condition. For measurements, put the documented raw range and engineering range in the tag configuration and the unit on the display. Never infer a code meaning from the number; if the code table lives only in the programmer's head, writing it down is the first task.
How do you show diagnostics without a C script in every object? #
Point WinCC alarm configuration at the decoded tags and use ordinary tag displays for values; one configured alarm replaces the script in every object that showed the same condition, and it lands in the alarm history too.
Discrete conditions become alarms with their documented text. Coded values become text mappings against the code table. Measurements get unit and range on screen. Scripts stay for what configuration cannot express — a transformation or a behavior, written once where needed. The payoff is consistency: change the alarm once and every screen, plus the history, follow.
Two supporting points. Once alarm recording is configured, the system can also raise its own alarms for communication states; treat those as link-level information, not a substitute for PLC diagnostic tags or process alarms. And an alarm on an operator screen is information, not a protective function — safety actions belong in the controller. When the tag list runs to hundreds, importing a PLC tag CSV into an existing HMI tag database beats creating them one at a time.
Why does an imported OPC tag sit at zero or show a question mark? #
Because one of three layers failed: the server does not publish the item, the server runtime is not running, or the WinCC tag type does not match the item — and the fix belongs at the first failing layer, not in the graphics.
The documented order of operations is strict: create the tags on the server first, then configure on the OPC client a connection and a WinCC tag that communicates with those server tags, then activate Runtime on the server and on the client. Skip a step and the tag reads nothing.
Two checks in WinCC Explorer localize the failure:
- Right-click the OPC channel in the Tag Management tree and open System Parameters to verify the server entry. Question marks at runtime usually lead here, and checking WinCC OPC registrations after a 7.0 setup covers the registration side of the same fault.
- Select the OPC channel in Tag Management, select the external tag in the data window, and rest the mouse pointer on the tag; WinCC reports the connection status there.
How do you verify each layer from PLC to screen? #
Walk one tag end to end while its condition is active and demand a specific reading at each hop: a named item in the PLC, a live value in the server, a type-matched tag in WinCC, and the decoded state on the screen.
- At the PLC or its documentation: the item exists, its address or symbolic name is known, and its meaning is defined.
- At the OPC server: the published item is present, and its value changes or holds as the source condition dictates.
- In WinCC tag configuration: the tag points at that item with a matching type.
- On the screen or alarm list: the displayed state, text or measurement matches the mapping while the condition is true.
If the value is stale or missing, the first layer without its expected reading is the layer to fix, before any graphic is touched or any script written. Newer installations have built-in help here: WinCC Runtime Professional gives the OPC UA channel and its tags their own diagnostics options, starting with checking the connection configuration, and on the controller side Siemens documents the FB ReadSessionDiagnostics, which reads selected diagnostics from the Server node of the OPC UA server.
When is OPC the wrong layer for what you need? #
When the value you need is absent from the server's item list, no WinCC technique recovers it: expose the data in the PLC program, publish it from the server, or read the controller through a native driver instead.
If the diagnostic exists only as logic in the programmer's head, or in data the server does not publish, it has to be written to an address the server exposes — a PLC change, not an HMI one. When the slaves are remote I/O on a fieldbus, their diagnostics must be mapped into the PLC image before any server can publish them. And if the controller offers no OPC server at all, reading controller variables without an OPC UA server is a driver-level exercise with its own rules.
The three-layer test settles arguments of this kind: item in the PLC, item in the server, tag in WinCC. Present at all three, the value reaches the screen; absent at any one, that layer is the work.
Questions asked
What is the difference between a system alarm and a PLC diagnostic tag?
A system alarm is raised by the SCADA itself about its own states, such as driver or connection problems, once alarm recording is configured. A PLC diagnostic tag is data from the controller or a slave that you import, type and text yourself. Use the first for the WinCC-to-server link and the second for the machine; neither replaces the other.
Do I need the PLC program to decode a raw diagnostic word?
Yes, for the meaning. WinCC can split any 16-bit word into bits and fields, but only the PLC documentation or its author says what bit 15 or code 17 mean. Get the bit layout and the code table in writing before building screens; decoding by trial and error produces confident nonsense.
Is a tag that shows a steady number actually working?
Not proven. A constant can be a healthy steady state or an item nobody is updating. Force or observe a real change at the source, then confirm the value moves in the server and on the screen with it. Until you have seen the value change once, treat the tag as unverified.
Should decoding happen in the tag, on the screen, or in a script?
Decode once at the tag level: set the external tag type to match the server item, split packed words into internal tags or use bit monitoring, and let alarms carry the text. Screens then only display, and scripts stay reserved for transformations the configuration cannot express, so every screen stays consistent.