How-to
How an S7-1200 reads PAC3200 floats over Modbus RTU
Short answer
MB_MASTER takes register references, not the meter's offsets: DATA_ADDR is 40001 plus the offset, so offset 1 for the Va-n voltage becomes 40002, and DATA_LEN counts registers, so one 32-bit float needs a length of 2. The meter sends the high word first, which is already REAL order in S7-1200 memory, so the pair decodes with no swap.

On this page
The S7-1200 is the master on this link, the PAC3200 answers as the slave, and the two numbers that stall the setup are the request address and the request length. The answers: MB_MASTER takes the register-reference form of the address, so the meter's offset 1 for the Va-n voltage goes in as DATA_ADDR 40002, and DATA_LEN counts 16-bit registers, so one 32-bit float is a length of 2. The meter transmits the high word first, which is already REAL order in S7-1200 memory, so the returned pair decodes with no swap. What follows is the order that works: load the port, translate the address, size the request, then prove the decoded value against the meter display.
Wire the bus and load the port #
A configured serial port does not prove the meter hears anything, so build the link in this order:
- Match the project to the hardware: a CPU 6ES7215-1HG40-0XB0 with the CB 1241 RS485 module (6ES7241-1CH30-1XB0), configured under TIA V13 with no module fault. A port the CPU does not know about carries nothing.
- Wire the CB 1241 data pair to the PAC RS485 module (7KM9300-0AM00-0AA0) by both terminal diagrams, terminate only the two physical ends of the bus, and bond shield and reference as the module manuals specify. The meter's power terminals sit at mains potential, so make its RS485 connections with the panel isolated.
- Copy baud rate, parity and stop bits from the meter's communication menu into the port configuration, and set the meter's slave address in the request. The slave address selects the device; the register address selects the data; they are unrelated numbers.
- Execute the communication-load instruction once at startup, the call behind the MB_COMM_LOAD_DB instance, and wait for its done indication before triggering the first MB_MASTER job. A request issued before the port is loaded returns an error instead of polling.
- Run one transaction at a time, and change DATA_ADDR, DATA_LEN or the target buffer only between transactions, so every result belongs to exactly one parameter set.
Translate the offset and size the request #
The meter's Modbus manual lists each measurement at a Modbus offset, and an offset is the wire address itself, counted from zero: the Va-n (line-to-neutral) voltage sits at offset 1 and occupies wire addresses 1 and 2. MB_MASTER does not take wire addresses for this table; it takes the register-reference notation, holding registers as 40001 to 49999, with a 400001-based series once register numbers pass 9999. The translation is one addition, DATA_ADDR = 40001 + offset, and the length is a count of registers:
| Quantity | Value | Basis |
|---|---|---|
| Register size | 2 bytes (16 bits) | Modbus definition |
| One float | 4 bytes (32 bits) | meter's double-word float format |
| DATA_LEN for one float | 2 registers | 4 bytes divided by 2 bytes per register |
| DATA_ADDR for offset 1 | 40002 | 40001 + 1 |
Length counts registers, never bytes and never floats; the only correct length here is 2. An address in the 40001 series makes the instruction send the read-holding-registers function. A Modbus float always spans two registers with all 32 bits preserved end to end, and why Micro820 Modbus floats require two words and bit preservation shows the same two-word requirement on a different controller.
Worked example: Va-n at offset 1 into one REAL #
The inputs, each with its source:
- Meter table entry: Va-n at Modbus offset 1, floating point, two registers, from the meter's Modbus register list.
- Register size: 2 bytes, the Modbus definition.
- Value size: 4 bytes, the 32-bit IEEE 754 float the meter sends as a double word.
- Reference base: 40001, the MB_MASTER holding-register notation.
- Example network: the meter's display shows 231 V while you commission, read off the meter itself.
The rules in words: the request address is the reference base plus the offset, and the request length is the value's byte count divided by the bytes in one register.
The arithmetic:
- DATA_ADDR = 40001 + 1 = 40002
- DATA_LEN = 4 bytes ÷ 2 bytes per register = 2 registers
- Buffer = 2 registers × 2 bytes = 4 bytes, exactly one REAL
The result: a single read with MODE 0, DATA_ADDR 40002 and DATA_LEN 2 returns wire addresses 1 and 2, high word at 1 and low word at 2, and the four bytes land in the buffer in REAL order, so a REAL tag placed over the same four bytes reads directly.
The decision: if the decoded REAL lands within 1 V of the meter's display, the address, the length and the word order are proven; freeze the call and reuse the pattern for every other entry. If the number is near zero or wildly implausible instead, the two words are being combined low-word-first, so swap once and repeat the test. If the instruction ends in an error with no data, the fault is below this layer, in the port or on the bus.
Prove the words against the display #
The check has a bit-level version worth running once. Convert 231.0 V by hand: 231.0 = 1.8046875 × 2^7, so the exponent field is 127 + 7 = 134 and the mantissa is 0.8046875 × 2^23 = 6750208, giving the REAL 16#43670000. The buffer must therefore show 16#4367 in the first word and 16#0000 in the second, and every 230 V-class reading carries a first word in the 16#43xx band. Then guard against the failure that looks like success: a start address one register off still completes without an error, because the table is packed with adjacent floats, and it returns a neighbouring quantity that reads plausibly, another phase's voltage or a current where you expected volts. Verify each newly mapped entry against the display once before the value goes anywhere near the SCADA.
When the request still fails #
Each outcome points at one layer:
- No reply or a timeout status with the port loaded: nothing usable came back, so check the pair, the framing and the slave address first; the step-by-step for that case is why an S7-1200 MB master gets status 80C8 with no reply.
- An exception response: the meter rejects the function or the address, so confirm the offset against the table and move the start back to the value's first word.
- Data that decodes to a near-zero or absurd number: word order or alignment, so swap the two words once, or move the start address back one register.
- An invalid-data-address status on register numbers above 9999: the extended notation is in play, which is why Modbus error 8189 needs 400001 added to the register address.
With one value proven on the display, the rest of the table is the same three moves: reference base plus offset, two registers per float, high word first.
Questions asked
Do other Modbus masters also type 40002 for this offset?
No. The meter always receives protocol address 1 on the wire, whatever notation the master uses. A master that takes zero-based protocol addresses gets 1. A master that takes holding-register references with the 4 prefix gets 40002. A master with a plain one-based register field gets 2. Only the typed number changes with the convention; the request on the bus is identical in every case.
Can one request read several PAC3200 floats?
Yes, when the entries sit next to each other in the meter's table. Keep the translated address of the first value, count two registers per float, and set the length to the total: three adjacent floats need a length of 6 and a twelve-byte buffer. Entries that are not adjacent need separate requests. Each pair of words still decodes high word first, so one block reads cleanly as an array of REAL values.
Can the read use the input-register function instead of the holding-register one?
Yes. The meter serves the same table on both read function codes, and the instruction chooses the code from the address range: a DATA_ADDR in the 40001 series sends read holding registers, one in the 30001 series sends read input registers, and both return the same voltage. Pick one range and stay with it; switching conventions between requests only makes fault finding harder.
If I combine the two returned words into a double word myself, which word is the high half?
The word from the lower register address is the high word: shift it left by sixteen bits, OR in the second word, and view the result as a REAL. Assembled the other way round, a healthy line-to-neutral reading collapses to a value near ten to the minus forty, the classic signature of a reversed float. When the request writes its four bytes straight into a REAL-tagged buffer in wire order, no shifting or swapping is needed at all.


