Integrating Modbus RTU Power Meters via TCP Gateway to S7-300

David Krause16 min read
Industrial NetworkingSiemensTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Integrating Schneider PM810 Modbus RTU Power Meters via an EGX300 Gateway to a Siemens S7-300 CPU and Bridging to S7-400 on the PCS7 Plant Bus

This reference covers the field-proven architecture used to land Schneider Electric PM810 Modbus RTU power meters on a Siemens S7-300 CPU through an EGX300 Ethernet gateway, and to forward the readings to an S7-400 AS station across the PCS7 Terminal Bus. The focus is on hardware selection between the integrated PN port of the CPU and a CP 343-1, the driver blocks required (2XV9450-1MB00 / 2XV9450-1MB02), commissioning steps, and the diagnostic checks that prove a clean integration before the OS clients begin polling for kW, kVA, kWh and power-factor values.

Critical architecture note. Modbus and Ethernet are not interchangeable. Modbus is a request/response application protocol; Ethernet is a physical and data-link layer technology. Modbus RTU runs on RS-485 with a CRC-16 trailer; Modbus TCP runs on TCP port 502 with an MBAP header (7 bytes) and no checksum. A "Modbus to Ethernet converter" is therefore really a Modbus RTU to Modbus TCP gateway, such as the Schneider EGX300 or the AutomationDirect MB-GATEWAY.

1. System Architecture Overview

The target topology, in plain network terms, looks like the block diagram below. RS-485 trunks are kept short (typically inside a switchgear lineup), and the long runs out to remote meter clusters are taken over fiber or wireless modems that terminate at the EGX300's serial port. From the EGX300, the data is wrapped in Modbus TCP frames and forwarded to the S7-300's PROFINET interface. The S7-300 is then a node on the PCS7 Terminal Bus SCALANCE ring along with the S7-400, the Engineering Station (ES) and the Operator Stations (OS).

PM810 Meter #1Modbus RTU (RS-485) PM810 Meter #NModbus RTU (RS-485) EGX300 GatewayModbus TCP / RTU CPU 315-2 PN/DPor CP 343-1Modbus TCP Client SCALANCE X-200 / X-300 Terminal BusPlant Bus (Industrial Ethernet) CPU 416-3 / S7-400CP 443-1PCS7 AS ES / OS (WinCC)PCS7 Plant BusEngineering & HMI TCP 502 CPU-CPU SEND/RECV

The S7-300's role in this layout is twofold: it acts as the Modbus TCP client (or "master") polling the EGX300, and it acts as a data concentrator exposing the meter values to the S7-400 over the plant bus. Whether to keep the S7-300 at all, or to point the EGX300 directly at the CP 443-1, is a valid simplification when the CP firmware supports Modbus TCP, but in many greenfield projects the S7-300 station has already been mechanically installed and wired before the Modbus question is raised.

2. Modbus RTU vs Modbus TCP: Protocol Distinctions

Before commissioning the gateway, align the engineering team on three protocol facts that often get blurred in plant documentation:

Attribute Modbus RTU Modbus TCP
Physical layer RS-485 (2-wire or 4-wire), RS-232 10/100 Mbps Ethernet, fiber via media converters
Frame Address (1) | Function (1) | Data (N) | CRC-16 (2) MBAP (7) | Function (1) | Data (N)
Checksum CRC-16 polynomial 0xA001 None (rely on TCP)
Port Serial, no port TCP 502
Slave address 1-247 Unit ID inside MBAP (still 1-247)
Function codes 01, 02, 03, 04, 05, 06, 15, 16, ... Identical
Inter-frame silence 3.5 character times required Not applicable
Typical Siemens driver CP 341 with Modbus master license (6FL3210-2CE01) 2XV9450-1MB00 (CP) or 2XV9450-1MB02 (PN)

The MBAP header (Modbus Application Protocol) in a TCP frame is 7 bytes:

Byte 0-1 Byte 2-3 Byte 4-5 Byte 6
Transaction ID Protocol ID (0x0000 for Modbus) Length (unit ID + func + data) Unit ID (slave address)

The PM810 register map is published by Schneider Electric. The relevant holding registers for an energy dashboard are clustered around the 4000x range; for example, real-time measurements such as current, voltage and power-factor start at register 4000. Verify exact addresses against the latest PM810 user manual on the Schneider Electric website before coding the data block layout.

3. Hardware Selection: Integrated PN Port vs CP 343-1

Either interface can act as a Modbus TCP client when paired with the correct driver blocks. The decision is driven by traffic loading, redundancy, and the number of free PROFINET ports you have on the CPU for other devices (I/O, HMI, drives).

Criterion Integrated PN Port (CPU 315-2 PN/DP, 317-2 PN/DP, ...) CP 343-1 (e.g. 6GK7 343-1EX30)
Driver blocks 2XV9450-1MB02 (PN interface) 2XV9450-1MB00 (CP interface)
Max simultaneous Modbus TCP connections Up to 8 (depends on CPU type) Up to 16 on CP 343-1 EX30
PG/OP/HMI routing Yes, but shares the port with PROFINET Yes, isolated from the PROFINET I/O
Recommended when gateway is on the same cable as the plant bus SCALANCE Yes (one cable, VLAN separation) Yes (separate physical port)
Recommended for high I/O count + Modbus No (CPU scan time impact) Yes (offloads TCP/IP stack)
Firmware impact None extra, ships in CPU firmware CP firmware v2.x or v3.x; must match driver version

Field-proven recommendation. Use the CP 343-1 for the plant-bus connection (so the gateway and the S7-400 share the same SCALANCE without contention) and the integrated PN port for the I/O on the floor. Where only one Ethernet interface is available, place both the EGX300 and the plant bus SCALANCE on the same switch and configure VLANs to keep Modbus TCP traffic out of the PROFINET real-time class.

Port sharing pitfall. The integrated PN interface has a single MAC and a single IP. If the gateway and the plant bus are on the same subnet, broadcasts from one side reach the other. A managed SCALANCE with VLAN tagging (e.g., VLAN 10 for Modbus, VLAN 20 for plant bus) is the cleanest fix. If the EGX300 is a simple unmanaged device, isolate the gateway on a separate IP subnet and route through the CPU.

4. Schneider EGX300 Gateway Configuration

The EGX300 (part of Schneider's PowerLogic range) acts as a Modbus TCP server on its Ethernet side and a Modbus RTU master on its RS-485 side. By default it polls the downstream PM810s and caches the latest values, exposing them as standard Modbus TCP registers. The configuration tool is the EGX300 web interface; you set:

  1. IP address, subnet mask, default gateway (must be reachable from the S7-300 interface that will poll it).
  2. RS-485 baud rate and parity (PM810 default: 19200 bps, 8E1).
  3. List of downstream meter addresses (1-247).
  4. Polling interval (e.g., 1000 ms).
  5. Optional: write a static route so the EGX300 is reachable on the plant bus if you decide to skip the S7-300 concentrator.

After configuration, validate the link independently of the PLC: use any Modbus TCP tester (such as mbpoll on Linux) to read holding register 0 of a known PM810. A successful read confirms the RS-485 trunk, the gateway's polling, and the Modbus TCP server side - so any later failure is definitely inside the S7-300 side.

# Example: mbpoll read of PM810 register 0 via EGX300
mbpoll -m tcp -a 1 -r 1 -t 4 -c 10 192.168.10.50
# -a 1   = Modbus slave 1 (PM810 address on RS-485)
# -r 1   = register 40001 (mbpoll is 1-based)
# -t 4   = holding register
# -c 10  = read 10 registers

5. S7-300 Modbus TCP Master Programming

Siemens publishes the Modbus/TCP PN-CPU block library and the Modbus/TCP CP block library. Both contain the same conceptual blocks: a client FB, a server FB, and helper FBs for connection management. Confirm the exact block numbers against the library you purchase:

Block Role Typical usage
FB 100 "MB_CLIENT" (CP variant) Modbus TCP client Polls EGX300 from the S7-300
FB 101 "MB_SERVER" (CP variant) Modbus TCP server Allows S7-400 to read S7-300 as a server (alternative path)
FB 65 "TCON" Open TCP connection Sets up the connection DB to the EGX300
FB 66 "TDISCON" Tear down TCP Clean shutdown on stop / restart
OB 1 / OB 35 Cyclic call Call MB_CLIENT every 100 ms in OB 35

The following skeleton (ST for an S7-300 in STEP 7 V5.5 or in the S7-300 target of TIA Portal) shows a typical client call. Adapt the instance DB names and connection IDs to your HWConfig.

// OB35 cyclic interrupt, 100 ms
// Connection to EGX300 (IP 192.168.10.50, Port 502, Unit ID 1)
CALL "MB_CLIENT" , DB100
   REQ        := TRUE                    // pulse to start a request
   ID         := 1                       // connection ID from TCON DB
   UNIT_ID    := 1                       // RTU slave address of PM810
   FUNC_CODE  := 3                       // 3 = read holding registers
   RD_START   := 0                       // start address (0-based)
   RD_AMOUNT  := 10                      // read 10 registers
   WRITE_COIL := FALSE
   WR_START   := 0
   WR_AMOUNT  := 0
   DATA_PTR   := P#DB200.DBX0.0 BYTE 20  // target data block
   BUSY       := MB_BUSY
   DONE       := MB_DONE_OK
   ERROR      := MB_ERR
   STATUS     := MB_STAT;

For each PM810, allocate a slice in DB200 (e.g., 20 bytes per meter) and assign a unique connection ID per TCP session. If you need to read more than one meter through the same EGX300, the EGX300 acts as a TCP server and you must use the Unit ID field (formerly the Modbus RTU slave address) inside the MBAP header to address the downstream meter. The driver library handles this transparently - you only set the UNIT_ID input.

Cycle time impact. Calling MB_CLIENT inside OB 1 with REQ held high will block OB 1 until the TCP round-trip completes. A 1 Gb Ethernet with 100 meters polled sequentially can easily add 5-10 s of OB 1 time. Always call MB_CLIENT in OB 35 (cyclic interrupt) and process the DONE/ERROR flags in OB 1 to keep the user program responsive.

6. S7-300 to S7-400 CPU-CPU Communication over Ethernet

The Profibus SEND/RECEIVE pattern the engineering team is familiar with has an exact Ethernet equivalent: ISO-on-TCP (RFC 1006) using the AG_SEND / AG_RECV blocks on the S7-300, or the more modern BSEND/BRCV / USEND/URCV pair on both sides. Setup in NetPro is identical in principle to Profibus: define a "S7 connection" or an "ISO-on-TCP connection" between the two CPUs.

Parameter Profibus (FMS / S7) Ethernet (ISO-on-TCP)
Connection type FDL S7 connection ISO-on-TCP (RFC 1006)
Block pair (S7-300) SEND / RECEIVE on CP 342-5 AG_SEND / AG_RECV on CP 343-1, or BSEND/BRCV on PN port
Block pair (S7-400) SEND / RECEIVE on CP 443-5 AG_SEND / AG_RECV on CP 443-1, or BSEND/BRCV on PN/IE port
Configuration tool HWConfig / NetPro HWConfig / NetPro (same screen)
Max payload per call 240 bytes (SEND) / 240 bytes (RECEIVE) 8192 bytes (BSEND/BRCV) or 240 bytes (AG_SEND/AG_RECV)
GSD file required? Yes, for DP slaves No (peer-to-peer over TCP)

For the S7-300 - S7-400 link on the PCS7 plant bus, the recommended pattern is:

  1. Open a S7 connection from the S7-300 (CP 343-1 or PN port) to the S7-400 (CP 443-1) in NetPro. The S7-300 is the active end; the S7-400 is the passive end.
  2. On the S7-300, pack the meter data into a DB (e.g., 4 kB buffer for 200 PM810s @ 20 bytes each).
  3. Call BSEND in OB 35 on the S7-300, triggered by a "data ready" flag from the Modbus client.
  4. On the S7-400, call BRCV in OB 1; copy received bytes into a PCS7-compliant DB that the OS faceplates will read.
// S7-300 side, send meter buffer to S7-400
CALL "BSEND" , DB300
   REQ        := SEND_REQ               // pulse
   R          := FALSE
   ID         := 2                      // S7 connection ID from NetPro
   R_ID       := DW#16#1                // raw ID, must match BRCV
   DONE       := SEND_DONE
   ERROR      := SEND_ERR
   STATUS     := SEND_STAT
   SD         := P#DB200.DBX0.0 BYTE 2000
   LEN        := METER_LEN;

The R_ID on both sides must match, the ID is the connection ID from NetPro, and the LEN must be exactly the number of bytes copied. A length of zero or a value larger than SD triggers STATUS 0x8085 ("Length parameter wrong").

7. PCS7 Plant Bus Integration Architecture

PCS7 separates the plant bus (engineering, OS, OS server, AS-AS communication) from the terminal bus. The Terminal Bus typically uses a SCALANCE X-200, X-300 or X-400 ring with redundancy protocols such as HRP or MRP. The CP 443-1 must be a model that supports plant-bus protocols: the 6GK7 443-1EX11-0XE1 used in this project is supported in PCS7 V8.x and later, but its firmware must be compatible with the Modbus TCP library if you also intend to use it as a Modbus TCP client in a future simplification. Always consult the Siemens Industry Online Support for the latest PCS7 compatibility matrix before substituting modules.

For the meter integration, the PCS7 OS faceplates are designed to read from the AS-side data blocks, so the path is:

PM810RTU (RS-485) EGX300Modbus TCP S7-300 ASMB_CLIENT + BSEND S7-400 ASBRCV into PCS7 DB PCS7 OS / WinCC Faceplate

The OS server polls the S7-400 (not the S7-300) by PCS7 convention. This is why the S7-300 - S7-400 BSEND/BRCV pair is essential even though it adds latency compared to a direct read. The latency budget is usually acceptable: a 100 ms OB 35 on the S7-300, plus a 200 ms plant-bus cycle, plus OS update of 1 s, still keeps the operator view below 2 s for any single meter change.

8. Configuration Verification & Diagnostics

Once the wiring and the STEP 7 program are loaded, run the following verification sequence. It is intentionally ordered from low-level (no PLC required) to high-level (OS faceplate updates).

# Test Pass criterion Tool
1 PM810 visible on RS-485 bus mbpoll or Modscan returns correct register values Laptop + USB-RS485 + mbpoll
2 EGX300 polls PM810 and serves Modbus TCP mbpoll -m tcp returns same values as test 1 Laptop on the EGX300 Ethernet
3 S7-300 reaches EGX300 (TCP 502) TCON returns STATUS 0x0000 (no error) STEP 7 online - DB for connection state
4 MB_CLIENT reads holding registers DONE=TRUE, ERROR=FALSE, STATUS=0x0000; DB200 holds expected values STEP 7 monitor/modify, VAT table
5 BSEND on S7-300 reaches S7-400 SEND_DONE=TRUE; S7-400 BRCV status=0x0000; S7-400 mirror DB matches STEP 7 online both sides
6 PCS7 OS faceplate updates Tag value in WinCC explorer shows the meter value within 2 s of register change WinCC Graphics Designer test

Key STATUS codes from the Modbus TCP driver (2XV9450-1MB00 / 2XV9450-1MB02):

STATUS (hex) Meaning Field action
0x0000 No error Continue
0x7000 Job active, no error yet Wait for DONE
0x8001 Invalid connection ID Check NetPro, ID must match TCON DB
0x8005 Timeout waiting for response Verify EGX300 IP, subnet, no firewall on SCALANCE
0x8008 Modbus exception code 02 (illegal data address) Check RD_START vs PM810 register map
0x8009 Modbus exception code 03 (illegal data value) Check RD_AMOUNT and start address range
0x80A1 Connection error / resource Check CP/CPU resource, no duplicate ID
0x80C3 TCP connection aborted by remote EGX300 was restarted; check keep-alive

9. Troubleshooting Matrix

Symptom Most likely cause Verification Fix
STATUS 0x8005 on every MB_CLIENT call EGX300 not reachable on TCP 502 From S7-300 CPU: ping via PN/CP online diagnostics Correct IP / VLAN, disable any ACL on SCALANCE that blocks port 502
STATUS 0x8008 with partial reads PM810 register map offset off by one Compare against PM810 manual Adjust RD_START (0-based) or use 1-based start in mbpoll to verify
Intermittent errors, OK on retry RS-485 termination missing or biased line Scope on RS-485 A/B lines; check for echo Add 120 ohm termination at both ends; bias resistors on master side
BSEND DONE never sets S7-400 BRCV not called in OB 1 Online both CPUs, check S7-400 BRCV EN line Add BRCV to S7-400 OB 1; R_ID must match
OS faceplate stuck at zero OS tag pointing to S7-300 instead of S7-400 WinCC tag diagnostics Repoint tag to the S7-400 mirror DB per PCS7 convention
Some meters visible, others not Duplicate Modbus address on RS-485 Disconnect meters one at a time Re-address each PM810 with a unique address (1-247)
Slow OS update MB_CLIENT called in OB 1 OB 1 scan time online Move to OB 35; reduce RD_AMOUNT; raise OB 35 period

10. Spare-Part, Documentation and Driver Reference

Use the following official documents to verify part numbers, firmware and library versions for your specific PCS7 release. Always cross-check against the latest revision on the manufacturer's website before placing orders.

Siemens part numbers used in this architecture:

MLFB / Order Number Description
2XV9450-1MB00 Modbus/TCP driver blocks for CP 343-1 / CP 443-1
2XV9450-1MB02 Modbus/TCP driver blocks for integrated PN interface of the CPU
6GK7 343-1EX30-0XE0 CP 343-1 (typical 6GK7 343-1EX30 series, firmware v3.x)
6GK7 443-1EX11-0XE1 CP 443-1 (S7-400 plant-bus interface)
6ES7 315-2EH14-0AB0 CPU 315-2 PN/DP

11. Frequently Asked Questions

Does the S7-300 need a GSD file for the EGX300 gateway?

No. GSD files are only used on PROFIBUS DP. On PROFINET/Ethernet the EGX300 is a pure Modbus TCP server. The driver blocks 2XV9450-1MB00 (CP) or 2XV9450-1MB02 (PN) are imported into STEP 7 as a library, and the connection is configured with the IP and port in the TCON DB - no GSD and no device description file are required.

Can I use the integrated PN port and a CP 343-1 at the same time, on the same CPU?

Yes. A CPU 315-2 PN/DP has both the integrated PROFINET interface and at least one free slot for a CP 343-1. The typical split is PN for PROFINET I/O and CP 343-1 for the plant-bus / Modbus TCP, but the assignment is up to the engineering team. Just make sure the IP subnets do not overlap and that the routing table in the CPU does not have a duplicate default route.

Will the S7-300 still poll meters correctly if I run MB_CLIENT in OB 1?

It will, but it will block OB 1 until the TCP transaction completes. With 100+ meters this can add many seconds of scan time and the CPU will go into STOP if the watch-dog trips. Call MB_CLIENT from a cyclic interrupt OB (OB 35, typically 100 ms) and only set the REQ pulse after the previous call has finished (rising edge on DONE or on ERROR).

What is the practical difference between Modbus RTU and Modbus TCP for the S7-300 wiring?

Modbus RTU requires a CP 341 with a Modbus master license and an RS-485 cable to the meter. Modbus TCP keeps the RS-485 cable local to the EGX300 and only the EGX300 needs an Ethernet drop at the S7-300. For multi-kilometer runs, Modbus TCP over fiber between the EGX300 and the S7-300 is the practical choice; RS-485 is limited to about 1200 m at 19200 bps.

Can the S7-400 read the EGX300 directly and skip the S7-300 concentrator?

Yes, if the S7-400 has a CP 443-1 with the Modbus TCP driver blocks (2XV9450-1MB00) and a free connection slot. The CP 443-1 EX11 supports the Modbus TCP library in PCS7 V8.x and later. In that case the OS tags point at the S7-400's meter DB and the S7-300 station is no longer required. Always confirm the exact CP 443-1 firmware on the Siemens Industry Online Support compatibility tool before removing the S7-300.

Back to blog