When the panel software has no math functions, a numeric display can show only a tag that already holds the result. Compute the sum in the controller: scale every Modbus source to one unit, match signed and word order, hold the total in a 32-bit register, and point the display at that one tag.
You need a numeric display that shows the sum of values from two or more Modbus slaves, and the panel software has no math functions to build it. A numeric display reads one tag, so the addition cannot happen on screen. Compute the sum in a device that can read every source, scale each source to one unit, match the data types and word order, and hold the result in one register the panel reads like any other tag. This page gives the checks that keep the total correct, a worked example with the arithmetic shown, and the tests to run before operators rely on the number.
Can an HMI numeric display add two tags together?
No, because a numeric display shows the contents of one tag, and when the panel software ships without math functions there is no expression field to combine two Modbus sources, so the sum has to exist as a register somewhere the panel can read.
A tag maps to one address on one slave station, so nothing inside the panel can combine two tags into a third number. Panel software without math functions shows it plainly: the numeric display object carries no expression field, and the maker's documented position for one widely used line was that no math functions existed and none were scheduled. Software changes between releases, so read the release notes of the version you actually run before building anything. Math or scripting listed there means you can do the add on the panel and skip the workaround below.
What goes wrong when you try to fake the total on the panel?
Three workarounds fail in ways you can predict: side-by-side displays leave the adding to the operator, a shared tag can hold only one of the two values, and a total built from raw register counts mixes scales that never belonged together.
Work through the symptoms before writing any logic, because each points at a specific break:
- The display shows 0 or nothing: the tag points at a register that nothing ever writes. Start with checking the tag address first.
- The total jumps into five-digit nonsense after one value goes negative: the negative value is being read as a large unsigned number.
- The total looks plausible but is wrong after a meter swap: the two sources differ in scale or, for two-register values, in word order.
- The total freezes: a slave stopped answering and its last polled value is sitting in the result.
- The operator adds two displays by eye: the requirement that the user selects values and sees a total is unmet, and hand-added totals drift.
Where should the sum be computed: panel, controller or gateway?
Compute the sum in a controller that can already act as a Modbus master, check the meters' register maps for a totalized register first, and add a computing gateway only when no such controller sits on the segment.
Start with the meters themselves. Many power meters and drives expose a pre-computed or totalized register in their own map; if the value you need already exists, the panel reads that one register directly and no math is needed anywhere.
Then look at who polls whom. The Modbus serial specification defines one master per bus, with slave addresses 1 to 247, so one segment cannot carry a polling panel and a polling controller at the same time. If the panel is the current master, move the master role to the controller and let the panel read the controller's result registers, or confirm the panel can itself be polled as a slave. Two masters on one segment collide, the same failure as two HMI panels on one PLC serial port.
When no controller with Modbus master capability sits on the segment, add a small gateway that polls the slaves, computes the sum and exposes it as a register the panel reads.
What do you confirm in each register map before adding?
Four lines of each slave's register map decide whether the total is right: the signed or unsigned data type, the engineering-unit scale, the word order of any 32-bit value, and the size of the destination register.
Signed or unsigned. 16 bits hold 65,536 combinations: read as signed, the range is -32,768 to 32,767; read as unsigned, it is 0 to 65,535. A reading of -1 that enters an unsigned sum becomes 65,535, so 65,535 + 2,344 = 67,879 instead of 2,343. Data-type mismatches are the standard cause of nonsense numbers from a BCD analog register.
Engineering-unit scale. Convert every source to one unit inside the controller before the add. Tenths to whole units divide by 10; whole units to tenths multiply by 10.
Word order. A 32-bit integer or float spans two registers, and devices differ in which word arrives first. The sum is garbage if the order is wrong; displaying a PLC float stored in two word registers walks that check.
Destination size. Two unsigned 16-bit sources can add to 131,070, past the 65,535 ceiling of a 16-bit result, so hold the total in 32 bits, where the signed range reaches 2,147,483,647.
How do the panel and the controller split a user-selected sum?
Split the job into three moves: the panel writes one selection bit per source, the controller adds only the selected and valid values into a 32-bit result register, and the panel shows that one register on the numeric display.
Put the bits in controller memory, addressed like any other tag the panel writes, and give each one a pushbutton with a lamp beside it so the operator sees the current selection. Track freshness at the same time: each source gets a validity bit the master sets on every good poll and clears after your missed-poll limit; in the example below that is 3 missed polls at a 1 s poll rate, so the flag rises about 3 s after a meter goes quiet.
The controller side is a few lines. The names are illustrative; use your controller's own addressing:
SEL[1..n]: BOOL GOOD[1..n]: BOOL SCALED[1..n]: DINT
TOTAL: DINT := 0 TOTAL_VALID: BOOL := TRUE
FOR i := 1 TO n DO
IF SEL[i] AND GOOD[i] THEN
TOTAL := TOTAL + SCALED[i]
END_IF
IF SEL[i] AND NOT GOOD[i] THEN
TOTAL_VALID := FALSE
END_IF
END_FOR
Map one panel tag to the result register, type it as signed 32-bit, set its decimal placement to the stored unit, and drive the display color from TOTAL_VALID through an alarm tag. Changing a numeric display color from an alarm tag shows the setup.
Can you show a worked example with real numbers?
Two Modbus power meters feed one controller: meter A holds 4,215 in tenths of a kilowatt, meter B holds 2,344 in whole kilowatts, and the correct total of 2,765.5 kW appears on the panel only after the controller scales both to tenths and adds.
Setup: one controller as Modbus master polls both meters every 1 s over RS-485. Meter A's active-power register is signed, scaled at 0.1 kW per count, and holds 4,215, which is 421.5 kW. Meter B's register is unsigned whole kilowatts and holds 2,344.
Wrong path: add the raw counts and the panel shows 4,215 + 2,344 = 6,559, a number with no unit behind it.
Right path: store every source in tenths of a kilowatt. Meter A already counts tenths and stays 4,215. Meter B converts as 2,344 x 10 = 23,440 tenths. The total is 4,215 + 23,440 = 27,655 tenths, written to a 32-bit result register. Hand check: 421.5 + 2,344 = 2,765.5 kW, and 27,655 shown with one decimal place reads 2,765.5. The numbers match.
Overflow test: the operator adds meter C, which holds 50,000 tenths, or 5,000.0 kW. The running total becomes 27,655 + 50,000 = 77,655 tenths. A 16-bit signed destination stops at 32,767, so the display goes wrong; on controllers that wrap, 77,655 - 65,536 = 12,119 tenths, shown as 1,211.9 kW. A 32-bit destination covers up to 2,147,483,647, so 77,655 fits with room for more meters. Decision: integer tenths in a 32-bit register.
How do you verify the total before operators trust it?
Prove the chain with six tests that take about 15 minutes on a bench: known values in the sources, each selection bit alone, one negative value, one near-maximum value, one unplugged meter, and the displayed decimal checked against the register at three points.
- Write known values into two source registers, or use a steady process load, and compare the panel total with a hand calculation. It must match exactly after scaling.
- Toggle each selection bit alone. The total must change by exactly that source's scaled value.
- Force one source negative, or catch a night-time export on a power meter. The total must subtract; a 65,535-class jump means the sign handling is wrong.
- Push one source near its maximum and watch the result register for an overflow indication.
- Unplug one meter. After the missed-poll limit, 3 polls at 1 s in the example, the invalid indicator must light and the total must stop including that meter.
- Compare the display's decimal placement against the controller register value at low, mid and high points of the range.
What is the decision when the panel software cannot do math?
Let the controller do the math: poll the meters, scale every source to one unit, hold the sum in a 32-bit register the panel can read, and give the panel only selection pushbuttons, the numeric display and an invalid indicator.
Assign or order one device that polls the slaves and computes: the controller already on the segment if it can act as Modbus master, otherwise a computing gateway. Read its register map the same way, because the result register has to be addressable and typed for the panel tag.
Recommendation: Compute the total in the controller that already talks Modbus, scale every source to one unit before the add, hold the result in a signed 32-bit register, and give the panel three jobs only: write the selection bits, display the one result tag, and show the invalid flag. Order a computing gateway only when no controller on the segment can act as master.
If the same project wants a notice or status board beside the line, our shop-floor displays run offline playback from their own storage. They are not Modbus devices and cannot poll your meters, so the HMI keeps the total and the board carries notices.
Questions
Can I put something on screen tonight without touching the PLC?
Yes, as a temporary measure only. Put each source value on its own numeric display, labeled with its unit and scale, and tell operators the numbers are separate until a total exists. That keeps the shift running, but nobody can select values and see one sum, and hand-added totals drift. The controller-side sum is the permanent repair; take the temporary screens off the day it goes live.
What happens to the total when one meter stops answering?
The controller keeps writing the last polled value into the result unless you track freshness, so the total looks live while it carries a stale number. Give each source a validity bit the master sets on every good poll and clears after your missed-poll limit, for example 3 misses at a 1 s poll rate. Drop invalid sources from the add and light the invalid indicator, so the operator knows the displayed total is short one meter.
Can the controller compute in floating point instead of integer tenths?
Yes, and it removes the scale conversion, but the result register then spans two registers, so the panel tag must be typed as a 32-bit float and match the controller's word order or the display shows nonsense. Integer tenths are simpler when every source is already an integer count: the total stays one register, one tag type, and the display's decimal setting does the unit conversion.
Planning information, not legal or engineering advice. Rules differ by place: check codes and permits with your local authority and your licensed trades.