The meter's display says 512,000 kWh. Your Modbus tool reads register 10 and shows 7. Register 11 shows 53,248. Neither number looks like energy, and both are correct. They are the two halves of one Modbus 32 bit register value, and you have to put them back together.
This guide explains how 32-bit and 64-bit values are stored over Modbus, how to combine two registers by hand (Excel, PLC or script), and what goes wrong on site.
What is a Modbus 32 bit register?
Strictly speaking, there is no 32-bit register in standard Modbus. The MODBUS Application Protocol Specification V1.1b3 (modbus.org) defines holding registers and input registers as 16-bit values. A device that needs more than 16 bits uses two consecutive registers and calls the pair a "32-bit register", a "long", a "DWORD" or a "double register".
The specification does not define 32-bit data types at all. It only says that each 16-bit register is sent big-endian (high byte first). Which of the two registers holds the high half is left to the manufacturer. That single gap explains most of the trouble technicians have with 32-bit values.
How many registers does each data type use?
| Data type | Bits | Registers | Range or precision |
|---|---|---|---|
| uint16 | 16 | 1 | 0 to 65,535 |
| int16 | 16 | 1 | −32,768 to 32,767 |
| uint32 (unsigned long, DWORD) | 32 | 2 | 0 to 4,294,967,295 |
| int32 (signed long, DINT) | 32 | 2 | −2,147,483,648 to 2,147,483,647 |
| float32 (IEEE 754 single, REAL) | 32 | 2 | About 7 significant digits |
| uint64 | 64 | 4 | 0 to 18,446,744,073,709,551,615 |
| int64 | 64 | 4 | −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
| float64 (IEEE 754 double, LREAL) | 64 | 4 | About 15–16 significant digits |
Typical uses: uint32 for counters and run hours, int32 for signed power, float32 for live measurements, 64-bit types for large energy totals.
How to read a 32-bit value over Modbus (two registers)
Read both registers in one request, then combine them. The steps are the same whatever tool or PLC you use:
- Find the start address in the register map. A 32-bit value is listed with its first register (for example "30011, 2 registers, UINT32" or "address 10–11").
- Convert the address to the 0-based address on the wire if the map is 1-based (30011 → input register address 10). See 40001 vs address 0 if you are not sure.
- Use the right function code: 03 (Read Holding Registers) or 04 (Read Input Registers), with a quantity of 2 (4 for 64-bit values).
- Combine the two words in the order the device uses (high word first or low word first).
- Interpret the 32 bits as uint32, int32 or float32, then apply the scale from the map (×0.1, ×0.01…).
Why one request, not two?
If you read register 10, then register 11 in a separate request, the value can change between the two reads. A counter going from 0x0007FFFF to 0x00080000 can be read as 0x0007 + 0x0000 (458,752) or 0x0008 + 0xFFFF (589,823): both wrong. Device manuals often recommend reading both halves in one request for this reason, and some devices reject a request that starts in the middle of a 32-bit value with exception code 02 (see Modbus exception code 2). One request with quantity 2 avoids both problems.
The specification allows up to 125 registers per function code 03 or 04 request, so you can read many 32-bit values at once.
The formula: combining two registers into one 32-bit number
Call the register that holds the most significant half Hi and the other one Lo. Then:
- uint32 = Hi × 65,536 + Lo
- int32: compute the uint32 first; if it is 2,147,483,648 or more, subtract 4,294,967,296.
- float32: put the 32 bits together (Hi in the top 16 bits) and reinterpret them as an IEEE 754 single. Multiplication cannot do this; you must copy the bits (see below).
65,536 is 2¹⁶: the high word counts in steps of 65,536.
Worked example 1: an energy counter (uint32, high word first)
From the simulated main power meter used in the screenshots below: input register 10 = 7 (0x0007), register 11 = 53,248 (0xD000).
- High word first (ABCD): 7 × 65,536 + 53,248 = 458,752 + 53,248 = 512,000 kWh. Matches the display.
- Low word first (CDAB): 53,248 × 65,536 + 7 = 3,489,660,935. Absurd.
- The same CDAB bits read as int32: 3,489,660,935 − 4,294,967,296 = −805,306,361. Also absurd.
Worked example 2: run hours (uint32, high word zero)
AHU controller, holding registers 20 and 21: 0 and 18,234 (0x473A). High word first: 0 × 65,536 + 18,234 = 18,234 h.
This is the most misleading case on site. Register 21 alone already shows the right number, so someone tags a single uint16 at address 21 and moves on. It works for years, until the counter passes 65,535 h. Then the high word becomes 1, register 21 drops back to 0 and the tag "resets". The data was never wrong; the tag was half of it.
Worked example 3: a negative int32
A meter exporting power reports −1,500 W as int32. In hex, −1,500 is 0xFFFFFA24, so Hi = 0xFFFF (65,535) and Lo = 0xFA24 (64,036).
- uint32 = 65,535 × 65,536 + 64,036 = 4,294,965,796
- Since it is above 2,147,483,647: 4,294,965,796 − 4,294,967,296 = −1,500 W
If your tool shows 4,294,965,796, it is decoding a signed value as unsigned.
Formulas for Excel, PLCs and scripts
| Where | uint32 from Hi and Lo | int32 | float32 |
|---|---|---|---|
| Excel / Sheets | =A2*65536+B2 |
=IF(C2>=2^31,C2-2^32,C2) |
No simple formula; use the free register converter |
| Python | (hi << 16) \| lo |
struct.unpack('>i', struct.pack('>HH', hi, lo))[0] |
struct.unpack('>f', struct.pack('>HH', hi, lo))[0] |
| IEC 61131-3 PLC | Shift Hi left 16, OR with Lo into a DWORD/UDINT | Move the DWORD to a DINT | Copy the DWORD bits to a REAL (often a COP/MOVE/union, not a numeric conversion) |
The common PLC mistake is converting the DWORD to REAL with a numeric conversion (in many PLCs, DWORD_TO_REAL works this way). That turns 0x43660000 into 1,130,758,144.0 instead of reinterpreting the bits as 230.0. For floats you need a bit copy, not a conversion.
Word order: which register holds the high half?
The two common orders are:
| Name | Also called | Register N | Register N+1 |
|---|---|---|---|
| ABCD | Big-endian, high word first | Hi | Lo |
| CDAB | Word swap, low word first | Lo | Hi |
Two rarer orders also swap the bytes inside each register (BADC and DCBA). The same four orders apply to int32, uint32 and float32. The full explanation, with float examples, is in Modbus float byte order: ABCD, CDAB, BADC, DCBA.
Quick ways to recognise a word swap on integers:
- A counter that jumps by 65,536 for each real step.
- Small values that read as multiples of 65,536 (18,234 × 65,536 = 1,194,983,424 for the run hours above).
- A value that is right only while it stays below 65,536.
64-bit values over Modbus (four registers)
64-bit values use four consecutive registers, read with quantity 4. Meters with large lifetime energy totals sometimes use uint64 or float64, and some controllers use them for totalisers.
The combination is the same idea with more words. With W1 the most significant word and W4 the least:
uint64 = W1 × 2⁴⁸ + W2 × 2³² + W3 × 65,536 + W4
Word order is even less consistent than with 32-bit values. Some devices put the most significant word first, some reverse all four words, and naming differs between tools. Test against a known value from the display.
float32 precision: why big totals stop counting
float32 holds about 7 significant digits. IEEE 754 single precision has a 24-bit significand, so it can store every whole number exactly only up to 16,777,216 (2²⁴). Above that, the gap between two possible values grows:
| Value range | Smallest step float32 can show |
|---|---|
| 512,000 | 0.03125 |
| 1,048,576 to 2,097,152 | 0.125 |
| 8,388,608 to 16,777,216 | 1 |
| 16,777,216 to 33,554,432 | 2 |
| 67,108,864 to 134,217,728 | 8 |
So a float32 energy total at 20,000,000 kWh can only move in steps of 2 kWh. If you log it every minute and compute consumption from differences, you get zeros and sudden jumps of 2. This is not a communication fault. It is why many meters publish totals as uint32 or 64-bit values, and live measurements (V, A, kW) as float32. If the map offers both a float and an integer version of the same total, use the integer one for billing and consumption.
Counter rollover on uint32 and int32
A uint32 counter rolls over to 0 after 4,294,967,295. How soon depends on the resolution the meter uses:
| Counter resolution | Maximum before rollover |
|---|---|
| 1 kWh | 4,294,967,295 kWh |
| 0.1 kWh | 429,496,729.5 kWh |
| 0.01 kWh | 42,949,672.95 kWh |
| 1 Wh | 4,294,967.295 kWh |
Some meters also roll over at their own lower limit (for example 99,999,999 to match a display) or provide a reset. Check the manual, and in your logger or BMS treat a sudden drop to a small value as a rollover, not as negative consumption.
Enron (Daniel) Modbus: real 32-bit registers
Some flow computers and gas measurement devices use Enron Modbus (also called Daniel Modbus), an extension used in the oil and gas industry. There, certain register ranges hold a full 32-bit value in a single register number: commonly a 5000 range for 32-bit integers and a 7000 range for 32-bit floats. Requesting one register returns 4 bytes, not 2.
The exact ranges vary by vendor, so check the manual. If a flow computer's map numbers separate floats consecutively (7001, 7002, 7003), it is probably Enron Modbus, and a standard master will show half or shifted values: use a driver that supports it.
How to read a 32-bit register in ModLens (step by step)
Any Modbus tool can do this by hand; ModLens shows every combination at once. The screenshots are real readings from ModLens connected to ModLens Sim, the free Modbus simulator.
Step 1: Read the block in the Explorer
Connect to the device, open Explorer, set unit ID 2, table Input registers, start address 8, count 6, and click Read. Each row is one 16-bit register; the int32, uint32 and float32 columns combine it with the next register.

Register 10 reads raw 7 (0x0007) and register 11 raw 53,248 (0xD000). On row 10, int32 ABCD and uint32 ABCD both show 512000, the energy total. int32 CDAB shows −805,306,361 and float32 ABCD shows 7.17 × 10⁻⁴⁰.
Step 2: Check every interpretation in the inspector
Click the 🔍 next to address 10. Under If it uses 2 registers, the inspector lists float32, int32 and uint32 in both word orders, each combined with register 11.

The list gives exactly the numbers from worked example 1: uint32 ABCD 512,000, uint32 CDAB 3,489,660,935, int32 CDAB −805,306,361.
Step 3: Watch for the "high word is zero" trap
Now read unit 1, Holding registers, start address 18, count 6. This is the run hours counter from worked example 2.

Register 20 is 0 and register 21 is 18,234 (0x473A). uint32 ABCD and int32 ABCD on row 20 show 18,234 h; int32 CDAB shows 1,194,983,424 (18,234 × 65,536). Notice the green cell: float32 CDAB shows 47,616, which looks like a plausible number but is not the run hours. The green highlight means "looks like a measurement", not "is correct". The register map, or a second reading after the value changes, decides.
Step 4: Let Find a value test every format
If you only know the number on the display, open Find a value, type it (here 512000) and click Search. ModLens tries every data type, byte order and common scale across unit IDs and both tables.

It finished in 3 seconds with two candidates: unit 2, input, address 10, uint32 ABCD and the same address as int32 ABCD, both raw 7 53248. For a counter that never goes negative, choose uint32. If several addresses match, wait for the value to change, type the new value and click Re-check candidates: only the real register stays. The ModLens install and user guide explains each option.
Step 5: Save it as a tag
Click Make tag. The form is filled with unit ID 2, input registers, address 10, data type uint32 and byte order ABCD (big-endian). Add a name and the unit (kWh), set a scale if the map gives one, and save.

The tag reads both registers together on every poll and can trend, alarm and log to CSV around the clock, on Windows or a Raspberry Pi. To try it on your own meters, the free 14-day trial includes every feature.
Writing 32-bit values
Use function code 16 (Write Multiple Registers) with both registers in one request. Function code 06 writes a single register, so writing a 32-bit setpoint with two FC06 writes leaves the device with a mixed value for a moment, and many devices reject or ignore half-writes on 32-bit parameters. The specification allows up to 123 registers per FC16 request.
Before writing, read the value first and confirm the data type and word order. Writing 150.0 as float32 ABCD to a device that expects CDAB stores a completely different number.
Common mistakes with 32-bit Modbus values
| Symptom | Likely cause | Fix |
|---|---|---|
| Value correct but "resets" at 65,535 | Only the low register is read | Read both registers as uint32 |
| Value jumps by 65,536 per step | Word order swapped | Switch ABCD ↔ CDAB |
| Huge value near 4.29 billion | Signed value decoded as unsigned | Use int32 |
| Value close but wrong decimals (floats) | Start address off by one | Check 0-based vs 1-based address |
| Exception 02 on a 32-bit value | Request starts in the middle of the pair, or quantity 1 | Start at the first register, quantity 2 |
| Total stops counting or moves in steps of 2 | float32 precision limit | Use the integer or 64-bit version of the total |
| Sudden huge drop in a counter | Rollover | Handle rollover in the logger or BMS |
| PLC shows 1.13e9 instead of 230.0 | Numeric conversion instead of bit copy | Copy the bits into a REAL |
When you document a point, always write the data type, word order and scale next to the address. The energy meter register map guide shows how manufacturers usually present this.
FAQ
Can a Modbus register hold 32 bits?
Not in standard Modbus. Each holding or input register is 16 bits, so a 32-bit value uses two consecutive registers that must be read together. The exception is Enron (Daniel) Modbus, used in some flow computers, where certain register ranges hold a full 32-bit value per register number.
How do I combine two Modbus registers into a 32-bit value?
Multiply the high register by 65,536 and add the low register: 7 × 65,536 + 53,248 = 512,000. For a signed int32, subtract 4,294,967,296 if the result is 2,147,483,648 or more. For a float32 you must reinterpret the 32 bits as an IEEE 754 single, which needs a bit copy, not arithmetic.
How many registers do I read for a 32-bit value?
Read 2 registers for int32, uint32 and float32, and 4 registers for int64, uint64 and float64. Start at the first register listed in the map and use one request with that quantity, so both halves come from the same moment.
What is the difference between int32 and uint32 in Modbus?
Both use the same two registers. uint32 is unsigned (0 to 4,294,967,295) and suits counters and run hours. int32 is signed (−2,147,483,648 to 2,147,483,647) and suits values that can go negative, such as exported power. If a value near zero shows as about 4.29 billion, it is signed data decoded as unsigned.
Why does my 32-bit Modbus value jump by 65,536?
The word order is swapped: the low register is being used as the high word. Each real step of 1 then appears as a step of 65,536. Switch between ABCD (high word first) and CDAB (low word first) and the counter will count normally.
Why does my value stop at 65,535 and start again from zero?
You are reading only one of the two registers. The value is a 32-bit counter, and the register you read is its low half, which rolls over to 0 every 65,536 counts while the high half increases by 1. Read both registers as uint32 starting at the first one.
Is float32 accurate enough for energy totals?
For live values like voltage or power, yes. For large totals, not always: float32 has about 7 significant digits and stores whole numbers exactly only up to 16,777,216. Above that, a total moves in steps of 2 or more, which ruins consumption calculations. Prefer the meter's uint32 or 64-bit total when it offers one.
How do I write a 32-bit value to a Modbus device?
Use function code 16 (Write Multiple Registers) and write both registers in one request, in the word order the device expects. Writing the two halves separately with function code 06 can leave a wrong value for a moment or be rejected. Read the value back afterwards to confirm it.