Implementing Modbus RTU RS485 Master Communication via CP 341 for Electrical Energy Meters in SIMATIC PCS 7
To establish Modbus RTU RS485 master communication between a CP 341 communications processor and slave electrical energy meters (such as Schneider PowerLogic PM750) in SIMATIC PCS 7, insert the hardware dongle into the rear of CP 341, load the Modbus Master driver in HW Config, and deploy driver blocks P_SND_RK (FB8) and P_RCV_RK (FB7). To query holding registers (e.g. Frequency at register 4012), configure the SEND DB with Modbus Function Code 03 and zero-based starting address 16#0FAB (decimal 4011). To read 32-bit floating point registers, read 2 consecutive 16-bit registers and swap words in CFC if endianness differs. Inspect the CP 341 diagnostic buffer and verify RS485 2-wire polarity (pins 4 and 11) if TX/RX LEDs remain inactive.
Table of Contents
- Executive Summary
- CP 341 Modbus RTU Master Architecture and Hardware Dongle Requirements
- Modbus Register Addressing Mechanics: 1-Based vs 0-Based Offsets
- Send and Receive Data Block (DB) Structure for Function Code 03
- Modbus RTU Communication Configuration Matrix
- Step-by-Step Procedure to Configure Modbus RTU on CP 341
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
Executive Summary
Integrating electrical energy management into industrial automation systems is vital for tracking power consumption, peak demand, and electrical power quality. In SIMATIC PCS 7 facilities, communicating with third-party electrical power meters (such as Schneider Electric PowerLogic PM750, PM800, or Siemens PAC3200) over serial RS485 networks is routinely accomplished using the CP 341 serial communication processor (6ES7341-1CH02-0AE0). However, automation engineers new to serial Modbus routinely encounter communication stalls: the TX/RX LEDs fail to flash, receive data blocks remain unpopulated, or numerical values in the receive buffer are garbled. Resolving these issues requires understanding the hardware dongle requirements, Modbus function code offsets (1-based vs 0-based), and proper structuring of the SEND_DB and RECV_DB parameter blocks.
CP 341 Modbus RTU Master Architecture and Hardware Dongle Requirements
The CP 341 module executes serial communication protocols via loadable driver packages:
- Hardware Dongle (Dongle Key): Operating CP 341 as a Modbus Master strictly requires inserting a hardware dongle (SIMATIC Modbus Master Dongle) into the rear slot of the CP 341 module before inserting it into the rack. Without this physical key, the Modbus driver refuses to initialize.
- Loadable Driver Package: The Modbus Master driver must be loaded into the CP 341 via the 'Load Drivers' button in HW Config.
- Driver Blocks: In the S7 CPU program, communication is coordinated using standard function blocks:
P_SND_RK(FB8) to transmit poll telegrams andP_RCV_RK(FB7) to receive slave responses.
Modbus Register Addressing Mechanics: 1-Based vs 0-Based Offsets
Modbus address mapping is a frequent source of integration error:
- Holding Registers (4xxxx): In device documentation, holding registers are conventionally documented with a leading '4' (e.g. register
4012for frequency in Schneider PM750). - Zero-Based Protocol Addressing: In the actual serial Modbus frame, register numbers are 0-based:
Telegram Address = Register - 1. - Thus, register
4012corresponds to protocol address4011(16#0FABhex). - Furthermore, if the meter documents registers in a 1000-series range (e.g.
1012for float), confirm whether the device implements holding registers in that address range queried via Function 03.
Send and Receive Data Block (DB) Structure for Function Code 03
To trigger a read request via P_SND_RK, the SEND DB must be formatted with the 6-byte Modbus Master telegram header:
DBB 0: Slave Address (e.g.6).DBB 1: Function Code (e.g.16#03for Read Holding Registers).DBW 2: Starting Register Address (e.g.16#0FABfor 4011).DBW 4: Number of Registers to Read (e.g.2for 32-bit float or1for 16-bit integer).
When the slave responds, P_RCV_RK copies the raw byte stream into the designated RECEIVE DB.
Modbus RTU Communication Configuration Matrix
The following table compares configuration requirements for reading electrical meter parameters via CP 341:
16#0FAB (4011)16#03 (Holding Reg)16#03F3 (1011)16#03 (Holding Reg)16#0FA0 (4000)16#03 (Holding Reg)16#0FB3 (4019)16#03 (Holding Reg)16#0000 (0)16#01 (Read Coils)Step-by-Step Procedure to Configure Modbus RTU on CP 341
Method: Configuring HW Config and S7 Driver Blocks
- Insert the Modbus Master Dongle into the rear slot of the CP 341 module.
- Open HW Config in SIMATIC Manager. Insert the CP 341 into the ET 200M or S7-300 rack.
- Double-click CP 341 to open properties. Under Basic Parameters, select protocol Modbus Master.
- Click the Parameter button. Set baud rate (e.g.
9600 bps), parity (NoneorEven), 8 data bits, 1 stop bit. - Set physical interface to RS422 / RS485 (2-wire mode).
- Click Load Drivers to flash the Modbus driver into the module EEPROM.
- Wire the RS485 2-wire cable: Connect meter terminal
+(B) to CP 341 pin 4 (T(A)-/R(A)-) and terminal-(A) to pin 11 (T(B)+/R(B)+). Ensure terminating resistors (120 ohm) are enabled at both physical line ends. - In the S7 Program, create DB1 (SEND_DB) and DB2 (RECV_DB).
- In
SEND_DB, define the poll header (Slave ID6, Function Code3, Start Register4011, Length2). - In CFC, instantiate
P_SND_RK(FB8) andP_RCV_RK(FB7). ConnectLADDRto the hardware start address and assignDB_NO. - Generate a cyclic pulse (e.g. 1-second clock memory) to trigger the
REQinput ofP_SND_RK. - Compile charts and download to the controller.
Verification
To verify Modbus RTU communication:
- LED Activity Check: Observe the front of CP 341. Confirm that the green TX LED flashes on poll transmit, followed immediately by the green RX LED flashing on slave response.
- Diagnostic Buffer Audit: Open CP 341 Module Information > Diagnostic Buffer. Confirm that zero framing, parity, or CRC error events are logged.
- Receive Buffer Inspection: Open
RECV_DBonline in a Variable Table (VAT). Verify that the received frequency value reads approx.50.0or60.0Hz matching line power.
Limitations and Operational Precautions
- 2-Wire RS485 Polarity Inversion: Different manufacturers label RS485 terminals inconsistently (A/B vs +/-); if TX flashes but RX never responds, swap the two RS485 signal wires at the CP 341 connector.
- Endianness / Word Swapping: Modbus transmits 32-bit floats as two 16-bit registers; if the received value is astronomical (e.g.
1.23E-38), swap the high word and low word using an SCL block or CFC converter (SwapW). - Master Dongle Requirement: The CP 341 hardware dongle must remain physically inserted at all times; removing the dongle halts the Modbus driver immediately.
Engineer FAQ
Can multiple Modbus slave meters be chained on the same RS485 line?
Yes, up to 32 standard RS485 slave devices can be multidropped along a single cable segment up to 1200 meters.
Why does P_SND_RK report error status 16#1E0F?
Status 16#1E0F indicates an invalid slave response or response timeout; check physical wiring, baud rate, and slave node ID.
Does PCS 7 include dedicated APL faceplates for electrical power meters?
Standard PCS 7 APL does not include power meter faceplates; the SIMATIC PCS 7 Industry Library or custom faceplates are typically deployed.
Technical References
- Siemens AG: CP 341 Point-to-Point Communication Installation and Parameter Assignment Manual (Doc No. A5E00850700)
- Schneider Electric: PowerLogic PM750 User Manual (Doc No. 63230-507-201A1)
- Modbus Organization: Modbus Application Protocol Specification V1.1b3
Related Articles
- https://industrialautomation.net/search?query=cp341+modbus+rtu+master+rs485+configuration
- https://industrialautomation.net/search?query=p_snd_rk+p_rcv_rk+send_db+structure+modbus
- https://industrialautomation.net/search?query=modbus+register+addressing+zero+based+offset
Related Tags
- https://industrialautomation.net/search?query=simatic-pcs7
- https://industrialautomation.net/search?query=modbus-rtu
- https://industrialautomation.net/search?query=cp341
- https://industrialautomation.net/search?query=serial-communication