IMDHMIControls LibraryShop main store

Selection guide

Choosing a CP-341 or gateway for an S7-300 Modbus RTU slave

Industrial networks Published 9 min read

Short answer

For an S7-300 that must answer as a Modbus RTU slave, a PROFIBUS DP-to-Modbus RTU gateway is the lower-effort route: no separately licensed loadable driver and no serial code in the CPU. Choose the CP-341 with its Modbus Slave (RTU) driver only when the link must be independent of the fieldbus or when you need a per-write flag such as CP_NDR. Before ordering, confirm the exact gateway variant runs DP slave and Modbus RTU slave simultaneously.

On this page
  1. Which route is less work for a Modbus RTU slave on an S7-300?
  2. What do you buy beyond the CP-341 module itself?
  3. How does the gateway sit between the S7-300 and the Modbus master?
  4. What must a gateway variant support before you order it?
  5. How do the cyclic DP bytes become Modbus holding registers?
  6. Which serial settings must match, and which address does the master poll?
  7. How do you test the link before the supervisory controller exists?
  8. Which route should you commit to?
  9. Questions asked

For an S7-300 that must expose data as a Modbus RTU slave, the PROFIBUS DP-to-Modbus RTU gateway is the lower-effort route: it needs no license beyond the gateway itself and puts no serial protocol code in the CPU. The CP-341 route also works, but the module alone does no Modbus, because you must also buy the loadable Modbus Slave (RTU) driver as a separate single license and program the MODB_341 instruction in the CPU. The deciding check before you order any gateway is that the exact variant runs PROFIBUS DP slave on the fieldbus side and Modbus RTU slave on the serial side at the same time. The sections below follow the choice in the order you meet it and end with the commit for each case.

Which route is less work for a Modbus RTU slave on an S7-300? #

The gateway route: configure the S7-300's DP port as master and let a dedicated converter answer the serial polls, which removes both the separately licensed CP-341 driver and all PLC-side serial programming from your scope.

Roles drive the effort. A Modbus RTU master initiates every request; a slave only answers requests addressed to it and never pushes status on its own. RTU is the framing: a fixed character format, a CRC on every frame, and a silent interval of 3.5 characters marking frame boundaries, as the Modbus over serial line specification defines it. PROFIBUS DP, standardized in IEC 61158 and IEC 61784, has the opposite habit: the master exchanges configured input and output data with each slave every bus cycle, without being asked.

That difference is why the gateway wins on effort. The DP side is hardware configuration plus a GSD import, the serial side lives in the gateway, and the CPU program only fills output words and reads input words.

CP-341 with Modbus Slave (RTU) driver PROFIBUS DP-to-Modbus RTU gateway
What you order CP 341 module plus the loadable driver as a separate single license the gateway; the CPU's integrated DP port is enough
PLC-side work parameter-assign the driver, call MODB_341 (FB80) cyclically, handle its data blocks import the GSD, configure one cyclic I/O module, move words
Serial protocol handling inside the PLC program inside the gateway
Per-write notification yes: FB80 V1.5 sets CP_NDR on every master write no: the PLC sees cyclic data, not requests
If the master later speaks Modbus TCP the serial CP-341 no longer fits and a gateway is added anyway swap to the TCP variant of the family; DP side and register map stay

What do you buy beyond the CP-341 module itself? #

The loadable driver Modbus Slave (RTU format), ordered as a separate single license for one installation, because the card ships as a plain serial processor and only speaks Modbus once that driver is loaded into it.

Siemens documents the CP 341 driver list, with STEP 7 version 4.x as the stated prerequisite, offering Modbus Master (RTU format) and Modbus Slave (RTU format) as separate loadable drivers; a documented slave driver version is Modbus Slave (RTU) V3.1 SP5. You load the driver into the CP through the CPU, then the program carries the MODB_341 slave instruction, the revised FB80 V1.5, whose CP_NDR input is set each time a Modbus master writes, giving the program per-access detection. The license is per installation: each CP 341 running Modbus needs its own licensed driver, so order it with the module rather than planning to copy one.

How does the gateway sit between the S7-300 and the Modbus master? #

The S7-300 is the PROFIBUS DP master, the gateway is a DP slave on that bus, and the same gateway answers as the Modbus RTU slave on its serial port; slave on both sides is a valid, normal gateway arrangement.

On PROFIBUS, the gateway takes a unique station address and is imported from its GSD file. On the serial side it answers at its configured Modbus slave address. There is no conflict in being the slave on both interfaces: the gateway moves data between its two ports and initiates on neither. A CPU with a free integrated DP port, such as the 314C-2DP in this project, needs no additional Siemens hardware for the master side. Input and output are named from the DP master's viewpoint: PLC outputs travel toward the gateway and PLC inputs come back, so equipment status the PLC publishes rides in DP output data. The DP side refreshes every bus cycle whether or not anyone asks, while the Modbus side moves only when polled, which is why Modbus polling is not the same as remote I/O.

What must a gateway variant support before you order it? #

Simultaneous DP slave and Modbus RTU slave operation on the exact variant, plus an importable GSD file, retained configuration, and an exportable backup file you can load into a replacement unit.

The two roles are not implied by connectors: plenty of converters pair Modbus with PROFINET or plain Ethernet and never offer a DP slave port. Hilscher's netTAP 50 and netTAP 100 are the usual candidate families, and they are not interchangeable; the exact variant's protocol table must list PROFIBUS DP slave and Modbus RTU slave together. MOXA also builds gateways, and its range includes Ethernet-oriented converters that give you no DP slave port, so order from the protocol table, never from the brand. Verify three more things before the order: the serial electrical interface (two-wire RS-485 versus RS-232) against the package's port; your register count inside the gateway's DP image and Modbus map limits; and retention, meaning the unit comes up configured after a power cycle and its tool exports a file you can keep with the project and load into a spare.

How do the cyclic DP bytes become Modbus holding registers? #

One DP output module of N bytes maps to N/2 holding registers byte for byte, with the gateway's mapping table deciding which register each word lands in; 20 bytes of status becomes registers 40001 through 40010.

Worked example. The S7-300 publishes 6 status words and 4 analog values with the S7 analog raw range of 0 to 27648:

  • 10 words x 2 bytes per word = 20 bytes, configured as one DP output module of 20 bytes (one module keeps the whole image a single consistent chunk).
  • Gateway mapping: DP output bytes 0 to 19 to holding registers 40001 to 40010, two bytes per register.
  • Check: 10 registers x 2 bytes per register = 20 bytes, which matches the module.
  • Placement: the 6 status words fill 40001 to 40006, so the first analog word lands in 40007.

Prove the path with a known number. Write 64 percent of full scale into the first analog word: 0.64 x 27648 = 17695 (0x451F). A master reading register 40007 must show 17695; if it shows 8005 (0x1F45), the gateway is swapping bytes. PROFIBUS and Modbus both send the high byte first, so leave any swap option off and retest. Keep the module's start address inside the CPU's process image, because a module configured above it loses its I/O entirely; fixing an S7-300 PROFIBUS gateway that is detected but reads no I/O data walks that fault. If the future master also writes setpoints, map its registers, say 40011 onward, into DP input bytes toward the PLC and test both directions.

Which serial settings must match, and which address does the master poll? #

Baud rate, parity, data bits and stop bits must be identical at both ends, and the master must poll the gateway's Modbus slave address, a number that is separate from and unrelated to the gateway's PROFIBUS station address.

The Modbus over serial line specification allows two RTU character formats: 8 data bits, even parity, 1 stop bit, or 8 data bits, no parity, 2 stop bits. Either way a character is 11 bits, the format must be fixed, and both ends must match it. The gateway's Modbus slave address, say 5, and its PROFIBUS station address, say 3, are separate numbers on separate networks; the master polls 5 and never sees 3. A master that ends up transmitting to address 0 has a configuration fault worth understanding before you chase wiring; why Modbus RTU sends to slave address 0 instead of your device explains the mechanism. On two-wire RS-485, compare signal descriptions rather than A/B labels, which differ between makers, and terminate both physical ends of the segment.

How fast the data moves, at 19200 baud with 8E1 (11 bits per character), polling all ten registers:

  • Request, function 03: 8 bytes x 11 bits = 88 bits, and 88 / 19200 baud = 4.6 ms.
  • Response: 25 bytes (address, function, byte count, 20 data bytes, CRC) x 11 bits = 275 bits, and 275 / 19200 baud = 14.3 ms.
  • Silent intervals of 3.5 characters before and after the response: 2 x 3.5 x 11 bits = 77 bits, and 77 / 19200 baud = 4.0 ms.
  • One poll cycle is about 4.6 + 14.3 + 4.0 = 23 ms, ignoring the gateway's turnaround time.

A 100 ms poll interval therefore runs with better than 4:1 margin, and the DP side is never the constraint: a 20-byte DP telegraph, roughly 28 bytes on the wire, is about 224 bits, and 224 / 1500000 baud at 1.5 Mbit/s is 0.15 ms. One slave and ten registers is a short poll; sharing one serial port among many slaves is what stretches polling, as why Modbus RTU drive polling on one serial port is slow shows.

Poll it with a temporary master, a laptop running a Modbus master utility through a USB-to-RS-485 converter aimed at the gateway's slave address, and prove that a forced state change in the PLC appears at the agreed register within one poll cycle.

The acceptance test is two lines. Force 17695 into the analog word and confirm register 40007 reads 17695; toggle a status bit in word 40001 and confirm it at the master. Worst-case freshness is the poll interval plus one frame, 100 ms + 23 ms = 123 ms, so any correct read inside 123 ms passes. Settle the roles on paper before wiring: today the laptop is the only master, and after handover the supervisory controller owns the polls and rewrites its own polling program, so the register map, slave address, serial format and electrical interface you hand over are the contract. Save the gateway configuration, export the backup file, and attach the poll log to the acceptance record.

Which route should you commit to? #

Commit to the gateway when the CPU has a free DP port and the deadline is tight, which is this project, and to the CP-341 only when the serial link must be independent of the fieldbus or when you must run logic on each master write.

  • This project, a 314C-2DP with a free DP port and a link tested now ahead of a real master: gateway. No additional Siemens purchases, no driver license, no MODB_341 program, and the commissioned DP side and register map survive the master's arrival.
  • No free DP port on the CPU: CP-341, or re-plan the bus, because the gateway needs that port.
  • Logic that must react to each individual master write: CP-341 with FB80 V1.5, since CP_NDR gives per-access notification that a cyclic gateway image cannot.
  • A supervisory side that may still change to Modbus TCP: gateway, replacing the serial variant with the TCP variant of the family while the PLC side stays.

A third route exists, software protocol conversion hosted on an industrial mini PC, and it earns its place only when that computer is already in the cabinet as a logger or OPC UA server; for one serial link it adds a PC to maintain.

Questions asked

Can one CP-341 Modbus driver license cover several modules?

No. Siemens sells each loadable driver, Modbus Slave (RTU format) or Modbus Master (RTU format), as a single license for one installation, so every CP 341 that speaks Modbus needs its own. A module that must both answer and poll needs two licenses, one per role.

Will the S7-300 know how often the master polls through the gateway?

No. In the gateway route the CPU exchanges only cyclic DP data with the converter; the polls, responses and CRC checks happen inside the gateway. The scan program cannot count requests or react to an individual one, which is exactly why this route is cheap to build.

Can two masters share the gateway's serial port?

Not on one RTU segment. The Modbus over serial line specification allows exactly one master per segment, and two initiators would collide on the wire. A second consumer needs its own serial port and slave address on a multi-port gateway, or a move to Modbus TCP, where each client opens its own session.

What changes if the supervisory controller turns out to speak Modbus TCP?

On the gateway route, only the converter: order the Modbus TCP variant of the same family, keep the DP configuration, station address and documented register map, and the master connects by IP address instead of a serial line. The CP-341 route would leave you adding a gateway anyway, which is a second reason to start with one.

Is a laptop enough as the acceptance-test master?

Yes. A USB-to-RS-485 converter and any Modbus master utility can run the whole test: poll the map, force values, and capture a log for the handover file. Remove the adapter when the test ends so the real master inherits a quiet, terminated segment with one device on it.

Keep reading

  • How-to

    Using a PLC as a Modbus RTU to Profibus gateway

    Keep the regulator and let one PLC carry both buses. Poll the regulator over Modbus RTU on a fixed cyclic interval, map every register to a defined PROFIBUS DP location with documented scaling, and hand the BMS a data-valid flag instead of stale values. Terminate each bus at its own two ends; never join RS-485 and PROFIBUS into one network.

    Industrial networks

  • How-to

    Driving a WAGO 750-653 Modbus RTU module from CODESYS

    On a CODESYS Control Win V3 soft PLC, WagoAppPlcModbus cannot reach a 750-653 behind a 750-354 EtherCAT coupler, because those blocks need WAGO controller firmware. Drive the module's raw process image yourself: set the serial parameters, move each fragment with the control/status byte toggle handshake, and frame the Modbus RTU request and response in your task. Each fragment costs at least two task cycles, so a full transaction takes ten cycles or more.

    Industrial networks

  • How-to

    Connecting an S7-1200 to a PROFIBUS slave through a CM 1243-5

    An S7-1200 cannot speak PROFIBUS from any built-in port: its onboard Ethernet is PROFINET. PROFIBUS DP-V1 master duty needs the CM 1243-5 communications module in the S7-1200 rack. Confirm the remote device is a PROFIBUS slave, import its GSD into TIA Portal, give it a bus address no other station uses, and terminate the segment at both ends.

    Industrial networks