IMDTouchKnowledge BaseShop main store

Troubleshooting

Why an MD REAL Address Overlap Shows Zero on the HMI Screen

PLCs and controllers Published 5 min read

Short answer

One of four identical temperature tags shows zero on the HMI because the four REAL values sit at MD12, MD14, MD16 and MD18. A REAL fills one double word, so each address writes into the previous value's bytes and the HMI reads a mix of two sensors. Re-space the starts to MD12, MD16, MD20, MD24 or declare the values in a typed global DB.

On this page
  1. Two rules that decide the layout
  2. Four REALs at MD12, MD14, MD16 and MD18
  3. Confirm the overlap before editing anything
  4. Re-space the addresses or move to a data block
  5. When the address is right but the value still reads wrong
  6. Questions asked

Three of four temperature tags read correctly on the HMI while the first sits at zero, and the PLC monitor shows a healthy value on that same tag. That combination is a memory-layout fault, not a sensor fault. The four REAL values are parked at MD12, MD14, MD16 and MD18. Each REAL fills one double word, so an address placed one word deeper than the last one shares half its bytes with the neighbor and the two writes tear each other apart. Move the four values to MD12, MD16, MD20 and MD24, or declare them in a typed global data block and let the compiler place them.

Two rules that decide the layout #

IEC 61131-3, the data-type standard behind these instruction sets, defines REAL as a 32-bit real number, and a double word is 32 bits: 4 bytes, 2 words. In the M memory area, an MD address covers its own byte number and the three bytes after it, with the first byte as the most significant, so MW12 is the high word of MD12 and MW14 is its low word. Two independent double words therefore need starts one full double word apart: after MD0 the next non-overlapping address is MD4, and after MD12 it is MD16. Absolute MD addresses carry no type or size check, so MD12 followed by MD14 compiles without a warning and fails only at runtime.

Four REALs at MD12, MD14, MD16 and MD18 #

Inputs: four sensor values written as REAL to MD12, MD14, MD16 and MD18, the layout behind this fault; a REAL sized 32 bits per IEC 61131-3; first byte most significant, so the first word of each MD is its high word.

Rule: MDn occupies bytes n through n plus 3, so two REALs overlap whenever their starts sit less than 4 bytes apart, the size of one REAL.

Arithmetic:

  • MD12 occupies MB12 through MB15 and MD14 occupies MB14 through MB17, so MB14 and MB15 belong to both: the low word of sensor 1 and the high word of sensor 2. The same chain repeats between MD14 and MD16 over MB16 and MB17, and between MD16 and MD18 over MB18 and MB19.
  • Take an illustrative reading of 25.4 °C on sensor 1. It stores as 0x41CB3333: high word 0x41CB, low word 0x3333.
  • When the scan order leaves sensor 2's high word holding sensor 1's low word 0x3333, the combined value carries a biased exponent of 102 and reads back near 0.00000004, which any display formatted like the working tags shows as 0.0.
  • When a value keeps its own high word and only its low half is rewritten, it shifts by a fraction of a degree and still looks believable.

Result: every displayed value mixes two sensors, and which tag collapses to zero depends on the write order each scan. The logic monitor still shows the value your own block wrote, which is why the PLC side looks healthy while the screen does not.

Decision: any two starts closer than one REAL size overlap. Re-space to MD12, MD16, MD20 and MD24; the block then ends at MB27 with no shared byte.

Confirm the overlap before editing anything #

  1. Rule out the mimics first: measure the sensor signal, confirm the scaling in the module or the scaling block, and confirm the HMI tag points at the intended PLC tag. Each of these produces the same one-zero symptom.
  2. Go online with a watch table that holds all four MD addresses plus the bytes MB12 through MB21.
  3. Force one distinct value into a single sensor input. If a second MD value moves with it, those two share bytes.
  4. Subtract the starts: 14 minus 12 leaves 2 bytes between MD12 and MD14, less than the size of one REAL. Overlap confirmed.
  5. Open the cross-reference list for each address: one byte range written from more than one place confirms the same finding.
  6. Check the data-type column of the tag table: every sensor tag must read REAL, and no two REAL starts may sit closer than one double word.

Re-space the addresses or move to a data block #

Option A keeps absolute addressing. Move the four starts to MD12, MD16, MD20 and MD24, or park the block in unused space: relocating the first value to MD1000 leaves a clean run of bytes above it. Update the tag table, rebuild the program, download, and repeat the watch-table test with four distinct values. HMI tags bound to PLC tag symbols follow on their own; HMI tags that carry the absolute address must be edited to the new numbers.

Option B removes the failure mode. Create a global data block, declare the four values by name as REAL, and point the logic and the HMI tags at those symbols. The compiler reserves a full double word per value, overlap becomes impossible, and the cross-reference list stays meaningful. Keep optimized block access enabled while the HMI connects by symbol; an HMI that connects by absolute byte address requires optimized block access disabled on that block, with the byte address taken from the block's offset column.

If any of these values also feeds an interlock or an alarm, retest that logic on the bench after the download before the machine runs product.

When the address is right but the value still reads wrong #

Once every value sits on its own double word, a remaining wrong number on one tag comes down to how the HMI tag pairs its data type and word order with the PLC address. The same double-word-to-HMI-address pairing is worked for another controller family in Mapping TM241 %MD real values to HMI %MF addresses, and the word-order side of a REAL read is worked for Modbus in Displaying a PLC Real value over Modbus on an HMI.

The decision for this fault stands on the spacing alone: four starts one word apart destroyed the first value, so re-space them or move them into a typed data block, download, and prove the fix by forcing one value and watching no neighbor move.

Questions asked

Does the spacing rule apply to other data types in the M area?

Yes. Any 32-bit type such as DINT, DWORD, UDINT or TIME fills one double word and needs its starts separated like a REAL. A 16-bit INT at a word address fills 2 bytes, so word starts need one word of separation. The rule is general: the gap between two independent values must equal the larger type's size in bytes.

Why did the PLC monitor show a good value while the HMI showed zero?

The engineering tool's monitor reads the tag at the moment your block writes it, so you see your own value. The HMI reads the same bytes later, after the neighboring tag has rewritten the shared bytes. Depending on the byte patterns left behind, that later read shows a shifted value, a huge number, or a tiny one that a normal display format rounds to zero.

Is absolute MD addressing acceptable once the values are spaced correctly?

Yes. A layout with every double-word start one full size from the next works, and parking the block in an unused range such as MD1000 leaves room to grow. The long-term risk is maintenance: the compiler does not stop a future tag from landing one word too close, which is why a typed data block is the safer permanent choice.

Can this fault be proven without hardware?

Yes, and it is a good bench habit, because the fault is pure data layout. In simulation or on the real controller, go online with a watch table, force four distinct values into the four addresses, and watch the byte view while you change one of them. When a neighbor's displayed number moves, the shared bytes are proven, with no sensor or wiring involved.

Keep reading

  • Explainer

    What the XSUB1 Block in a 505 Program Actually Does

    XSUB1 in a TISOFT 505 program is compiled special-function code that runs PID loops; it is not a serial driver for the MP370 panel. The RS-232 link to the panel needs no XSUB and no special program — the panel project carries its own 505 driver and the CPU port only has to match it. On TI545, TI555 and CTI 2500 CPUs the loops are integrated, so the block's job moves to native PID at the next planned change.

    PLCs and controllers

  • Troubleshooting

    Why WinCC Start and Stop buttons do not control an S7-300 output

    The Start and Stop buttons do nothing because E0.0 and E0.1 are S7-300 input image addresses: the CPU refreshes them from the input modules every scan, so an HMI write cannot survive. Step 7 simulation changes the simulated input state itself, which is why the LED follows it. Move the two commands to memory bits such as M0.0 and M0.1, latch them in the PLC, and let the program drive A4.0.

    HMI and touchscreens

  • Troubleshooting

    Why C-More Shows Tag Addresses You Cannot Set in Productivity

    That address is the System ID the Productivity controller assigned to the tag, not a field you can type into Productivity Suite. View it in the Tag Database column headers, and keep the workflow one-way: create and name tags in Productivity, export, then import into C-More.

    HMI and touchscreens