Explainer
Why WinCC flexible DWORD bits use a reversed byte map
Short answer
A WinCC flexible DWORD tag reverses the S7 byte order, so PLC bit M20.0 in MD20 appears at tag bit 24 and M23.0 at bit 0. Wire buttons from the reversed map, prove it once by toggling a single test bit, and one tag then serves up to 32 packed flags; a mixed-type data block never collapses into one tag.

On this page
- Why do the bytes of a WinCC flexible DWORD tag arrive reversed?
- Which HMI bit number holds PLC bit M20.0 in a DWORD tag at MD20?
- How do the four bytes of MD20 map onto the tag bits?
- Can one DWORD tag stand in for a whole DB of mixed data types?
- How many tags does packing flags into one DWORD actually save?
- How do I link a button to one bit of the DWORD tag?
- How do you prove the byte map before wiring operator controls?
- Questions asked
A DWORD tag in WinCC flexible 2008 is one tag carrying a full double word of PLC bits, but the panel numbers those bits from the opposite byte end than the S7-300 lays them down in memory. The byte order reverses between controller and panel, and the reversal decides everything downstream: PLC bit M20.0 answers at bit 24 of a DWORD tag addressed to MD20, not at bit 0. Wire every button and indicator from the reversed map and prove the map once by toggling a single test bit. A mixed-type data block never collapses into one tag; the tag saving comes from packing flags that belong together, and the sections below give the map, the limits, and the bench test that settles both.
Why do the bytes of a WinCC flexible DWORD tag arrive reversed? #
The S7-300 stores a double word with its first byte most significant, while the panel counts tag bits from the least significant byte, so the four bytes trade places: the byte you read first in the PLC owns the highest tag bits on the HMI.
STEP 7 defines DWORD as a bit string of 32 bits, and the S7 addressing lays those bits down as four consecutive bytes with the first byte carrying the highest weight. The panel-side numbering runs from the opposite end of the value, so nothing is corrupted and the tag value itself transfers intact — a numeric display of the address still reads a sensible number. The reversal only becomes visible when you pick an individual bit by hand, because the index you type refers to the panel's numbering, not to the order the bytes sit in PLC memory. That is exactly why the flag in the first byte of MD20 behaves as if it moved to the far end of the tag.
Which HMI bit number holds PLC bit M20.0 in a DWORD tag at MD20? #
PLC bit M20.0 sits at bit 24 of the DWORD tag addressed to MD20, and the rest of that byte follows in order: M20.1 through M20.7 occupy bits 25 through 31.
The last digit of the PLC address is not the tag index. The byte position inside the double word sets an eight-bit block, and the bit digit then steps through that block. One rule covers every flag: tag index = 24 − 8 × byte position + bit digit, counting marker bytes from MB20 as byte 0. M21.3 therefore lands at 16 + 3 = 19, and the first flag of the last marker byte lands at index 0. If you catch yourself typing just the digit after the dot, stop — that number belongs to a different byte entirely.
How do the four bytes of MD20 map onto the tag bits? #
Each byte lands on its own eight-bit block in reversed byte order: the first marker byte of MD20 owns the top block of the tag and the last owns the bottom, with the bit order inside each byte preserved.
| PLC byte (flags inside) | Index range if read in memory order | Actual index range on the panel |
|---|---|---|
| MB20 — M20.0 to M20.7 | 0–7 | 24–31 |
| MB21 — M21.0 to M21.7 | 8–15 | 16–23 |
| MB22 — M22.0 to M22.7 | 16–23 | 8–15 |
| MB23 — M23.0 to M23.7 | 24–31 | 0–7 |
Read the table from the left: the byte order reverses, the bits inside each byte do not. Every entry in the right-hand column is the number you enter on the panel side; every flag name is the signal you force on the PLC side. The controller-side half of this layout — why a flag in the first byte of a double word carries the highest weight by STEP 7 convention — is the same convention the guide to S7 DWORD bit addressing inside function blocks walks through from the controller side.
Can one DWORD tag stand in for a whole DB of mixed data types? #
No — a tag has exactly one address and one data type, so a DWORD tag represents 32 bits and nothing else; every INT, REAL, string, or unrelated flag in that DB still needs its own tag, and no configuration collapses them into one.
The saving comes from packing, not from bundling. Design the PLC layout deliberately: the flags that belong to one panel group go into one double word, and the panel addresses each of them through that tag's bit selection. A DWORD tag cannot represent a byte it does not contain, and reinterpreting a REAL as bit patterns is not a shortcut — it is a different value. The tag address entry itself follows the PLC area you target, which the walkthrough on addressing S7 PLC outputs in a WinCC flexible tag shows for the output area and the same address-entry discipline.
How many tags does packing flags into one DWORD actually save? #
One DWORD tag replaces up to 32 single-bit tags, because the double word holds 4 bytes of 8 bits each and every one of those bits can drive its own button, lamp, or alarm.
That is the whole mechanism: nothing bundles a data block, a string, or a REAL into the same count, and no configuration multiplies the saving beyond the bits the type physically holds. If your setup counts larger tags as power tags, the tag statistics inside your own project show what the packed DWORD costs against the limit — read that reported figure instead of assuming the packing halves anything. The decision follows from the type: pack flags that share a purpose into one deliberately laid-out double word, keep every numeric value on its own tag, and never count on a mixed data block collapsing into one tag, because it cannot.
How do I link a button to one bit of the DWORD tag? #
Enter the tag once and set the bit number of the tag link to the panel-side index from the table above; the bit selection belongs to the HMI tag, not to a second PLC address, and it is where the reversal is either applied or forgotten.
A discrete alarm follows the same logic. The WinCC flexible communication manual specifies that the addressed tag carries the bit that triggers the alarm, and the event fires as soon as the PLC sets that bit and it transfers to the panel — so an alarm on a packed flag keys on that one bit, entered with its panel-side index. A numeric message number is a different mechanism and does not substitute for the bit, which is the point why numeric message codes do not map to discrete alarm bits argues in detail. If the project rejects the bit entry while you configure it, that error is about address syntax rather than byte order; the fixes live in fixing invalid bit address errors when adding HMI tags.
How do you prove the byte map before wiring operator controls? #
Toggle one noncritical PLC bit at a time and watch which single tag bit moves, because the map is only trusted once the panel itself has confirmed it: set the flag, read the tag value, and match the set bit to the table.
Run the check on the bench with the machine in a state where nothing moves:
- Force one spare flag in the first marker byte of the test double word from 0 to 1. Use a flag with no live function; never test on an output that can move the machine or start a sequence.
- Read the tag value on the panel. For the first flag it must read 0x01000000, decimal 16,777,216. The hex shows the block structure directly: the top byte is 01 and the three lower bytes are 00, so exactly one bit is set and it sits in the top block.
- Confirm that the indicator linked to the mapped index lights and the indicator on index 0 stays dark — the value's lowest hex digit is 0, so nothing may move at the bottom of the tag.
- Repeat with one flag in each remaining byte. Expected panel values: 0x00010000, decimal 65,536, for the second byte's first flag; 0x00000100, decimal 256, for the third; 0x00000001, decimal 1, for the last. Each value carries exactly one set bit, at index 16, 8, and 0 respectively.
- Only when all four bytes behave as the table predicts, link the buttons, lamps, and alarms. If any indicator follows a different bit, the tag address or data type is wrong — correct it and re-run the full four-byte check before anything goes live.
The decision this test settles, for an S7-315 with WinCC flexible 2008: wire the first marker byte to the top block of the tag and the last to the bottom, treat one DWORD tag as one block of packed flags and nothing more, keep every mixed-type value on its own tag, and let the toggled value — 16,777,216 for the first flag — be the proof before an operator presses anything.
Questions asked
What happens if I wire a button to bit 0 instead of the mapped index?
It switches a different live signal. Under the reversed map the lowest index belongs to the last marker byte of the double word, so a button on index 0 acts on M23.0 rather than M20.0. Nothing warns you: the project compiles and the wrong flag moves at the machine. Run the single-bit toggle test on the bench before any operator control goes live, so the mismatch shows on a lamp instead of in production.
Does the same reversed byte map apply to a double word inside a data block?
Yes. The reversal follows the S7 double-word layout and the transfer, not marker memory, so a DWORD tag aimed at a DB double word shows the same block order: the DB byte at the lowest offset owns the highest tag bits. Confirm it with the same one-bit toggle test at the DB address, and check that the tag's byte offset matches the DB layout exactly.
Do INT and REAL tags need the same byte treatment?
No. Typed tags transfer as whole values through the driver, so a numeric display of an INT or REAL reads correctly with no byte handling at all. The reversal only matters when you address an individual bit inside a tag yourself, which is why the same double word can display a sensible number while a wrongly indexed bit still lands on the wrong flag.
How many separate signals can one DWORD tag carry, and what if the group is larger?
Thirty-two at most — four bytes of eight bits — with each bit driving one button, lamp, or alarm. For a larger group, design a second DWORD at the next free double-word address and apply the same map. Never stretch one tag past its bits or overlap addresses, because two operator objects on one bit will fight each other at the machine.
An indicator follows a different bit than the map predicts — what do I check first?
Stop linking controls and re-read the tag before blaming the map. Confirm the tag address is the double word you intended, that the data type is DWORD rather than a smaller type, and that the index was entered in the tag's bit selection rather than as a separate address. Then force one flag at a time again and record the value the panel reports for each toggle.


