Implementing Modbus RTU Master Communications in SIMATIC PCS 7 via CP 341 Application Guidelines

Implementing Modbus RTU Master Communications in SIMATIC PCS 7 via CP 341 Application Guidelines

Implementing reliable Modbus RTU Master communication in SIMATIC PCS 7 without relying on obsolete, unsupported legacy libraries (such as S7HMODM3) requires deploying the standardized Siemens Application Example for Modbus RTU (SIOS Entry ID: 61586633). This pre-engineered solution integrates a SIMATIC S7-300 CP 341 RS422/485 serial communication processor mounted in an ET 200M distributed I/O station with official PCS 7 driver blocks. The architecture utilizes the licensed Modbus Master loadable driver, standard CFC communication blocks (FB80 MODB341 or PCS 7 Industry Library blocks), and structured Send/Receive DB buffers to cyclically poll Modbus slave instruments with complete error logging and faceplate diagnostics.

Table of Contents

Architectural Framework of the Official Modbus RTU Application Example

Serial communication in process automation involves interfacing disparate field instruments—such as power quality analyzers, gas chromatographs, and weigh feeders—with the DCS over half-duplex RS485 lines. Because early custom libraries like S7HMODM3 caused severe maintenance and reliability problems, Siemens released the official application example 'Modbus Master RTU with CP 341 in PCS 7' (Entry ID: 61586633).

This application example establishes a rock-solid, validated engineering blueprint. It decouples high-speed serial bit transfers from the AS controller by delegating protocol execution entirely to the CP 341 hardware. Cyclic data exchange between the CP 341 and the CPU 410-5H / S7-400 occurs asynchronously over the ET 200M backplane bus using optimized system communication blocks.

Hardware Configuration: CP 341 in ET 200M Distributed I/O

To configure the serial hardware in Step 7 HW Config:

  1. Subrack Assembly: Place the CP 341 RS422/485 module (6ES7341-1CH02-0AE0) into an ET 200M rack (IM 153-2).
  2. Hardware Dongle: Plug the SIMATIC Modbus Master Hardware Key (6ES7870-1AA01-0YA0) into the rear receptacle of the CP 341 before snapping the module onto the DIN rail.
  3. HW Config Parameterization: In HW Config, double-click the CP 341. Under Protocol, select Modbus Master (click 'Load Driver' to flash the driver onto the module). Configure the serial transmission settings: 9600 or 19200 baud, 8 data bits, 1 stop bit, even parity, and 2-wire RS485 half-duplex mode.
  4. I/O Address Allocation: Assign a logical I/O start address (e.g., LADDR = 512) that will be referenced by the CFC driver blocks.

Configuring Modbus Telegram Schedules and Function Codes

In Modbus RTU, multiple slave devices share a single two-wire RS485 bus. The master must query each slave sequentially:

  1. Telegram Definition DB: Create a dedicated Data Block defining the polling sequence. Each telegram entry specifies the Slave Address (1 to 247), Modbus Function Code (FC 03 - Read Holding Registers, FC 04 - Read Input Registers, FC 16 - Write Multiple Registers), Starting Register Address, and Number of Registers.
  2. Sequencer Scheduling: A sequencer in CFC triggers telegram 1, waits for the DONE or ERROR handshake from the CP 341, latches the incoming data into the designated DB, and advances to telegram 2. An inter-telegram pause of 20 to 50 ms prevents bus collision.

CFC Block Engineering and Error Handling Strategies

In the CFC editor:

  1. Instantiate Driver Block MODB341 (FB80): Place the block in cyclic interrupt OB 35. Connect LADDR to the configured hardware address.
  2. Connect Telegram Pointers: Map the Send DB and Receive DB pointers to the block parameters.
  3. Diagnostic Evaluation: Monitor the STATUS output. Common error codes include 0x1E0F (Slave response timeout - check wiring/slave power), 0x1E0D (CRC checksum error - check baud rate/parity or line noise), and 0x1E0E (Modbus exception response from slave).
  4. Quality Code Generation: When a slave fails to respond, generate a Bad quality code (0x00) for the associated WinCC process tags to alert the operator.

Modbus RTU Master Procurement Schedule and Hardware Key

The following schedule outlines the necessary hardware modules, firmware dongles, and engineering packages required to implement this solution:

| Component Role | Official Siemens Component / MLFB | Purpose in Architecture |
|---|---|---|---|
| Communication Processor | CP 341-RS422/485 (6ES7341-1CH02-0AE0) | Serial interface module installed in ET 200M subrack |
| Protocol License Key | Modbus Master Dongle (6ES7870-1AA01-0YA0) | Hardware dongle containing runtime license and cryptographic key |
| Driver Software CD | Modbus Master Driver Package (6ES7870-1AA01-0YA0) | Parameterization software and Step 7 loadable driver DLLs |
| Distributed I/O Interface | ET 200M IM 153-2 HF (6ES7153-2BA10-0XB0) | Connects CP 341 to AS controller over PROFIBUS DP / PROFINET |
| Bus Connector | Sub-D 9-Pin Connector with Terminating Resistor | Provides RS485 termination (120 Ohm) at cable ends |

Commercial Accuracy Disclaimer: Software order numbers (MLFBs), package structures, and hardware capacity prerequisites vary across PCS 7 versions and hardware platforms. System integrators must confirm exact software entitlements and licensing requirements against the official Siemens Catalog CA 01 and obtain an authorized Siemens distributor quotation prior to purchasing.

Verification

Verify Modbus RTU Master operation:
1. Inspect the CP 341 front LEDs: confirm that the TxD and RxD LEDs flash alternately in synchronism with telegram dispatch.
2. Open the Modbus Receive DB online in Step 7; verify that integer and floating-point registers update continuously with valid field data.
3. Disconnect a slave device; verify that the CFC sequencer logs a timeout error for that specific device, bypasses it after retries, and continues polling the remaining healthy slaves.
4. Verify that WinCC faceplates reflect live readings and indicate communication health.

Limitations and Operational Precautions

Never omit terminating resistors on an RS485 network; reflections on unterminated cables cause frequent CRC framing errors. The CP 341 Modbus Master driver does not support simultaneous multi-master configurations; only one master can exist on an RS485 segment. The physical hardware key must remain seated in the back of the CP 341; removing it causes the module to stop transmitting Modbus telegrams upon the next reboot.

Engineer FAQ

Can I communicate with Modbus RTU devices without purchasing the hardware key?

No. The Modbus Master driver requires the hardware key to unlock transmission. Without the key, the CP 341 driver will reject initialization and output driver licensing error codes.

What is the maximum number of Modbus slaves on one CP 341?

Standard RS485 transceivers support up to 32 unit loads (slaves) per electrical segment without repeaters. Adding RS485 repeaters allows expanding up to the Modbus protocol limit of 247 slaves, though polling cycle latency increases proportionally.

Where can I download the official Siemens Modbus RTU PCS 7 application example?

It is available on Siemens Industry Online Support under Entry ID 61586633, containing sample multiprojects, CFC charts, and documentation.

Technical References

Related Articles

Related Tags

  • Modbus Master
  • CP 341
  • PCS 7
  • RS485
  • Application Example
6 respuestas