IMDHMIControls LibraryShop main store

Explainer

Why an S7-200 cannot share one RS-485 port with a PC and Modbus

Industrial networks Published 7 min read

Short answer

A CPU224 can serve a programming PC and four Modbus devices, but never through one shared RS-485 pair: a port runs either PPI programming traffic or the Modbus RTU master. Put the PC on port 0 and the Modbus master on port 1, wire the four devices as one terminated RS-485 trunk with unique addresses, and bring up each path separately before running them together.

On this page
  1. One RS-485 pair carries one protocol at a time
  2. Which port gets which job
  3. The PC link on port 0
  4. The Modbus segment on port 1
  5. Timing one sweep of four devices at 9600 bit/s on port 1
  6. Bring-up order and what each fault means
  7. The decision for a CPU224, a PC and four devices
  8. Questions asked

Yes, an S7-200 CPU224 can serve a programming PC and four Modbus devices at the same time, but not through one shared RS-485 pair. The CPU carries two RS-485 ports, port 0 and port 1, and one port carries one protocol at a time: PPI for programming, online monitoring and variable changes, or Modbus RTU for the field devices. The working layout is the PC on port 0 through a programming cable and the Modbus master running on port 1 into the four devices. No extra communication module and no gateway are needed. Putting the PC and the four devices on one pair is the one arrangement that cannot work, and no OPC server rescues it.

One RS-485 pair carries one protocol at a time #

Each port is one serial channel with one frame format. In PPI mode the CPU answers the engineering software: program transfer, online status, variable monitoring. In freeport mode the Modbus Master library owns the port and sends Modbus RTU frames to the devices. The port configuration decides which service runs; it is never both at once.

Put all five nodes on one pair and one of two failures appears, depending on the mode. With the port in PPI, the Modbus requests never leave the CPU and the four devices stay silent. With the library active, the PC's PPI frames arrive at a port that is not listening for them and the programming session cannot connect. Disabling the library to program and re-enabling it afterwards is a commissioning compromise, not simultaneous monitoring and polling.

OPC changes nothing here. An OPC server publishes CPU memory to the PC over a link that already works, in this layout the PPI link on port 0, and the PC then reads the polled device values out of that memory. It is not a serial multiplexer and it cannot merge two protocols onto one pair.

Which port gets which job #

Assign roles before buying cable. The PLC is the Modbus client, also called the master: it initiates every request. The four devices are Modbus servers, or slaves: each answers only requests carrying its own address. The PC is a PPI station. A Modbus RTU segment tolerates exactly one initiator, so if any of the four devices is itself a Modbus client, reassign ownership first.

Node Service it needs Path Role
PC with the STEP 7-Micro/WIN software programming, online monitoring, variable changes port 0, PPI programming station
CPU224 runs the program and polls the field devices port 1 Modbus client (master)
Four Modbus devices field data in and out RS-485 trunk on port 1 Modbus servers, one unique address each

The library decides the rest. The Modbus Master library can run on port 0 or on port 1; the Modbus Slave library v1.x is fixed to port 0. Running the master on port 1 leaves port 0 for the PC and keeps the only port the slave library can use free, in case the PLC must ever act as a Modbus slave as well. The master library's initialization instruction, MBUS_INIT, selects the port it owns and the serial framing it runs.

Both CPU ports are 9-pin D-sub RS-485 sockets, and the connector shape tells you nothing about the protocol; the port configuration does. Connect the PC with a PC/PPI cable or a USB/PPI adapter into port 0. In the engineering software's communications settings, select that adapter and a data rate matching the CPU port (the port configuration offers 9600 and 19200 bit/s), then search for the CPU on the link instead of assuming its station address.

Prove this path before touching Modbus: go online, read the CPU operating state and monitor one known variable. A PC that cannot hold this session makes every later Modbus symptom twice as hard to read.

The Modbus segment on port 1 #

Wire the four devices as one RS-485 trunk, daisy-chained from port 1 through each device, with drops as short as the layout allows. Keep pair polarity identical at all five nodes; take the pair and the signal reference from the pin assignment the CPU manual gives for the port, never from the connector's shape. Fit 120 Ω termination at the two physical ends only, the client end and the far device.

Provide one bias network for the whole segment, commonly a pair of 560 Ω resistors holding the idle line defined, and only if no connected interface already supplies bias. Two bias networks or mid-trunk terminations load the line and produce faults that look like software errors. Use a shielded twisted pair and bond the shield at the point your site practice designates. Wire the trunk with the segment de-energized wherever the device manuals require it.

Set identical framing on all five nodes (data rate, 8 data bits, parity, stop bits) and one address from 1 to 247 per device, all different. Each device's register map, including byte order and address notation, comes from its own manual, not from the Modbus standard.

One master polls one slave per transaction, so the sweep has a real time cost even when the wiring is right, which is why Modbus RTU drive polling on one serial port is slow whenever several nodes share a port.

Timing one sweep of four devices at 9600 bit/s on port 1 #

Inputs.

  • Devices polled in sequence: four, from your own case.
  • Port data rate: 9600 bit/s, the slower of the CPU's two port settings.
  • Character size: 11 bits (start bit, 8 data bits, even parity, one stop bit), as the Modbus over serial line specification fixes it for RTU with parity.
  • Frame separation: at least 3.5 character times of silence between frames, from the same specification.
  • Traffic per device: one function 03 read of a single holding register, an 8-byte request and a 7-byte reply under the Modbus application protocol layout (address, function, two starting-address bytes, two quantity bytes and a two-byte CRC; the reply returns a byte count and the register).
  • Left out on purpose: each device's answer delay, which its manual states.

Rule. The wire time per device is the request characters plus the reply characters, each at one character time, plus the two silent intervals around the reply; the sweep is four of those in sequence.

Arithmetic.

  • Character time = 11 bits ÷ 9600 bit/s = 1.146 ms
  • Request = 8 × 1.146 ms = 9.17 ms
  • Reply = 7 × 1.146 ms = 8.02 ms
  • Silent intervals = 2 × 3.5 × 1.146 ms = 8.02 ms
  • Per device = 9.17 + 8.02 + 8.02 = 25.2 ms
  • Full sweep = 4 × 25.2 ms = 100.8 ms

Result. One pass over all four devices costs about 101 ms of wire time before any answer delay. At 19200 bit/s the same sweep takes 50.4 ms.

Decision. For a monitor refreshing the four values once a second, 9600 bit/s spends about a tenth of the period on the wire and is the right setting; the slower rate also tolerates longer and noisier cable. If all four values must refresh within 100 ms, set the port to 19200 bit/s: the slower rate's wire time alone overruns that budget, while the faster rate leaves about half of it for the four answer delays. Each additional register in a request adds two characters to that device's reply, about 2.3 ms at the slower rate.

Bring-up order and what each fault means #

  1. PC alone on port 0: go online, read the operating state, watch one known variable update.
  2. One device on port 1: a single read of one documented register, the same procedure as when you connect an S7-200 to a Modbus RTU sensor and read its register.
  3. Add write requests only after the reads run clean; interleaving them too early is how a Modbus RTU read and write on one port drops VFD control.
  4. Add the remaining three devices one at a time, so any failure names the device just added.
Symptom First check Usual cause
No device answers pair polarity at the port and at the first device A and B swapped at one node
One of four fails that device's address and local wiring duplicate address or wrong register notation
Replies come and go termination count, branches, bias more than two terminators, a star branch, two bias networks
A value arrives but is wrong byte order, signedness, scaling decoded against the wrong device map

The decision for a CPU224, a PC and four devices #

Two paths, two cables, one drawing: the PC on port 0 over the programming cable, the Modbus master on port 1 into a terminated RS-485 trunk with four unique addresses. Reject any layout that lands the PC and the devices on one pair, whatever adapter or OPC server the drawing promises, and run the trunk at the slower port setting unless the monitor's refresh deadline forces the faster one. That is the whole network.

Questions asked

Can I stay online and watch variables while the PLC polls the devices?

Yes. That is exactly what the two-port layout gives you: the programming session holds port 0 while the master library polls on port 1, and neither disturbs the other. A program download is the exception, because the S7-200 accepts a download only in STOP, so the poll sweep pauses until you return the CPU to RUN.

Can the PC read the four Modbus devices directly instead of through the PLC?

Not on this wiring. The devices sit on the port 1 RS-485 segment, and the PC has no way onto that pair while the PLC is the only master. The PC reads the polled values from CPU memory over PPI, or through an OPC server on that same link. Moving device ownership to the PC means adding its own RS-485 adapter and giving up PLC control of the segment.

What happens to the Modbus segment when the CPU goes to STOP?

Freeport mode exists only in RUN. In STOP the port returns to PPI, so you can program through either port, but no Modbus requests go out and the four devices simply wait. Plan any STOP, including the one a download needs, as a pause in polling; the sweep resumes when the CPU runs again.

Do I need end termination on a short trunk?

Fit it. A bench-length cable at a slow data rate often works without termination and bias, then fails after a relocation, a longer run or a faster port setting. Two end resistors and one bias network remove a whole class of intermittent faults, and the termination belongs at the two physical ends of the trunk only, never at mid nodes.

Keep reading

  • How-to

    S7-200 Port 0 Modbus RTU wiring: pins 3, 8, termination

    Connect each counter's two-wire RS-485 pair to S7-200 Port 0 DB9 pins 3 and 8. Matching terminal letters is unreliable, so confirm polarity with a poll-and-reverse test. Fit one 120 ohm termination resistor at each of the two physical ends of the trunk and none at intermediate devices.

    Industrial networks

  • Troubleshooting

    Why a Modbus RTU read and write on one port drops VFD control

    A working Modbus RTU write proves only that the write request and its register are right. When adding a read to the same RS-485 port drops VFD control, the fault is almost always in the read path: an invalid read register, a timeout that overlaps the next transaction, or two requests colliding on one serial master. Keep the port mode that works, add one read at a time, and record the PLC timeout and error code for each.

    Industrial networks

  • How-to

    How a PLC runs two Modbus networks at the same time

    Yes. Each serial port is its own independent link: the HMI polls the PLC on one port while the PLC acts as master, or slave, on a separate RS-485 Modbus RTU network. The two links share no settings — only their endpoints must match — and PLC copy logic moves any data between them.

    Industrial networks