How-to
How a PLC runs two Modbus networks at the same time
Short answer
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.
On this page
- Can one PLC run two Modbus networks at the same time?
- Which device is the master on each Modbus link?
- What port settings must match, and which can differ?
- How should I wire the RS-485 segment?
- How much line time does one Modbus RTU poll cost?
- How does the HMI get data from the second network?
- What if my PLC has only one serial port?
- How do I commission the two links in a safe order?
- Questions asked
You can run two Modbus networks from one PLC at the same time, and the arrangement is simpler than it sounds: each serial port is its own independent link. Put the HMI on one port as the master, with the PLC answering as its slave, and run the second RS-485 port as a separate Modbus RTU network where the PLC is master, or slave, depending on who owns the poll cycle. The two links share nothing — no baud rate, no station addresses, no protocol role — but the two endpoints of each link must match, and the PLC program must copy any data that crosses between them. This article gives the role decision for each case, the port settings to verify, a worked polling-budget calculation, RS-485 wiring rules, a gateway option for single-port controllers and the commissioning order.
Can one PLC run two Modbus networks at the same time? #
Yes. Each serial port on the controller is an independent link with its own driver, protocol role and serial settings, so one port can serve the HMI as a Modbus RTU slave while another simultaneously runs master-to-slave exchanges on a second RS-485 network. Two ports are two separate hardware links, usually two separate UARTs, so a poll cycle on one port never queues behind traffic on the other. The links come up, fail and get diagnosed independently: a working screen connection proves nothing about the second network, and a fault on the second network never explains a frozen screen.
Roles are still set per port, and they are not interchangeable. Many compact controllers dedicate one port to programming and slave-only Modbus RTU duty while another port is fully configurable; the port chapter of the manual states which is which, so read it before assigning roles instead of assuming every port accepts every role. Decide each port's role first and write both decisions down — every setting that follows depends on them.
Which device is the master on each Modbus link? #
The HMI is the master on the screen link because operator entries must trigger reads and writes immediately, with the PLC answering as the slave; on the second link the role follows the remote device — the PLC polls it as master, or answers it as slave. That division is how Modbus RTU serial works: the specification permits one master per segment, every other station answers as a slave, and a slave never speaks first. An HMI that waited for the PLC to poll it would leave every operator action queued behind the scan, so the screen must own its request cycle.
The second link takes its role from whoever owns its poll cycle:
| Link | Master (initiates) | Slave (answers) | Why |
|---|---|---|---|
| HMI to PLC port | HMI | PLC | Screen refreshes and operator writes must start on demand |
| PLC to drive, remote I/O or meter | PLC | Remote device | The PLC owns the poll cycle and the process data |
| Plant master to PLC | Remote system | PLC | The upstream system owns the poll cycle |
Decision: leave the HMI as master on its port; make the PLC the master on the RS-485 port when your program must fetch or push values on its own schedule, and the slave when another system drives the exchange.
What port settings must match, and which can differ? #
The two endpoints of each link must agree on protocol, baud rate, data bits, parity, stop bits, station address and role; the two links themselves can differ — 19.2 kbit/s 8E1 on the HMI port beside 9600 bit/s 8E1 on the RS-485 port is a normal pair. Read and record each port's configuration separately before changing anything: protocol, serial format, station address where the port answers as a slave, master-or-slave mode where it initiates, and the response timeout on each master. Compare the record against the connected device's own settings rather than trusting the project file.
Forcing both ports to the same settings fixes nothing, because the ports are separate; what must match is each link's two endpoints, bit for bit, and a mismatch surfaces as CRC errors or dead silence on one link only. Change one variable at a time, and never change wiring and serial settings in the same session, or you will not know which change moved the fault. One note for fast ports: above 19200 bit/s the Modbus serial line specification fixes the inter-frame silent interval at 1.75 ms instead of scaling it with character time.
How should I wire the RS-485 segment? #
Follow TIA/EIA-485-A practice: one twisted pair in a daisy chain, A-to-A and B-to-B, a termination resistor equal to the cable's characteristic impedance — typically 120 Ω — across the pair at each physical end, and short stubs. Terminate only the two end stations and leave intermediate stations unterminated. Keep drop lines short, because a long stub defeats the end terminations and shows up as errors under load. Check polarity station by station, since one A/B swap distorts the whole segment, and confirm at least one device supplies the fail-safe bias its manual documents.
Confirm each port's electrical interface from its label and manual before adapting anything: an RS-232 pin cannot join an RS-485 pair, and converter adapters change the wiring rules. De-energize and lock out before opening the bus or adding terminations; rewiring a live segment risks the drive and the operator's window into the process at the same time.
How much line time does one Modbus RTU poll cost? #
Budget the wire time before you pick a poll rate: one request-and-response cycle for 8 holding registers at 9600 bit/s, 11 bits per character, takes about 37 ms of line time, so a 100 ms poll cycle consumes roughly 37 percent of the segment. The arithmetic, for a PLC acting as Modbus RTU master over one slave, function 03, 9600 bit/s, 8 data bits, even parity, 1 stop bit:
- Character time: 11 bits (start + 8 data + parity + stop) ÷ 9600 bit/s = 1.146 ms
- Silent interval between frames: 3.5 × 1.146 ms = 4.01 ms
- Request frame: 8 bytes × 11 bits = 88 bits ÷ 9600 bit/s = 9.17 ms
- Response frame: 21 bytes × 11 bits = 231 bits ÷ 9600 bit/s = 24.06 ms
- Poll total: 9.17 + 24.06 + 4.01 ≈ 37.2 ms
At a 100 ms poll period that exchange occupies 37.2 ÷ 100 = 37 percent of the segment, and a second slave with the same register block pushes the load near 75 percent, which leaves nothing for a retry after a CRC error. Keep the planned load under half the segment so a slow slave or a retry never eats the margin: poll at 200 ms for 18.6 percent, or move the port to 19.2 kbit/s and halve the wire time. Set the master's response timeout at 250 ms for this exchange — roughly six times the wire time, enough for the slave's own processing and one retry — and never below the slave's documented worst-case response. The same arithmetic sizes the screen link: an HMI reading 20 registers at 19.2 kbit/s spends about 32 ms per exchange, so a 250 ms refresh sits near 13 percent.
How does the HMI get data from the second network? #
It does not get it directly — two separate links never forward messages to each other, so the PLC program must copy the registers it receives on the RS-485 link into tags or registers the HMI link already reads, and copy operator commands back the other way. On every good response, move the received block and set a data-valid bit; after a fixed run of consecutive timeouts, clear the bit. Show that bit on the screen, because an operator acting on stale drive data is worse off than one looking at a flagged fault.
Build the map from the remote device's documented register map and your project's real addresses; invented offsets produce a link that talks and carries nothing. Keep the boundary in mind too: these links move register values only, never programs or project files — the same limit described in why Modbus cannot transfer a PLC ladder program over TCP.
What if my PLC has only one serial port? #
Add a second link as a gateway instead of overloading the one port you have: a dual-RTU converter or a gateway host such as an industrial mini PC restores two independent segments, each with its own master and settings. Serial-to-Ethernet converters move the second network onto Modbus TCP, where each connection is an independent socket: a controller holds several at once, one per task, and each keeps its own client-server pair.
When that gateway logic — a Modbus TCP server, a protocol converter, a small historian — has to run on a computer in the cabinet next to the controller, an industrial mini PC is the hardware for the job. If the second link instead crosses the plant to a SCADA server in another building, the medium decides more than the protocol does, and choosing PLC to SCADA communication over long distances works through those trade-offs.
How do I commission the two links in a safe order? #
Bring each link up on its own before running them together: back up both projects, prove the HMI link, prove the RS-485 link, then enable both and watch each port's communication-status bits through a full production run.
- Back up the PLC and HMI projects, then record every existing port setting: protocol, baud rate, data bits, parity, stop bits, station address and role.
- Configure the HMI link alone: select the HMI driver for the controller model, set the PLC port to its slave role with matching serial settings, and prove screen reads plus one operator write.
- Configure the RS-485 link alone: set the PLC's role to match the design, match serial settings and station address to the remote device, and verify polarity and terminations.
- Test that link through its worst case: one clean poll cycle, then disconnect the slave and confirm the timeout, retry and data-valid behavior you programmed.
- Enable both links and exercise the copy logic end to end: a value from the RS-485 device reaches the screen, and a screen command reaches the device.
- Watch each port's error counters and the scan time through a full run; if the screen shows question marks once both links are live, the cause is a comms timeout, and why HMI values show question marks walks that diagnosis down.
Decision, case by case. HMI link: HMI master, PLC slave, always, because operator actions must initiate the exchange. Second link: PLC master when your program owns the poll cycle, PLC slave when a device or plant system owns it. Single serial port: add a gateway and keep the segments separate. Two ports, two independent setting sets, one copy routine — and each link judged only on its own status bits.
Questions asked
Can two masters share one RS-485 Modbus segment?
No. The Modbus serial line specification allows exactly one master per segment; every other station answers as a slave at a station address from 1 to 247, with 0 reserved for broadcast. If two systems need the same slaves, give each master its own segment, or place a gateway between them so both sides keep independent links and settings.
Can the HMI and the remote device share one RS-485 pair?
Only as one network, never as two. A shared pair means one baud rate, one address plan and one master, so the HMI becomes a second slave polled by the PLC and reads the remote device's values through PLC registers. That works, but every screen refresh now loads the PLC's slave link.
Does Modbus TCP change any of this?
It makes the independence easier: each Modbus TCP connection is a single socket, a controller can hold several at once, and every connection carries its own client and server roles. One task can serve a SCADA client while another polls drives, with no shared serial line and no termination or biasing to manage on the Ethernet side.
How many slaves can the PLC poll on its RS-485 network?
The address plan allows up to 247 slaves per segment; the poll budget sets the real number. With the 37 ms example exchange, eight slaves polled every 500 ms need about 59 percent of the segment, which breaks the half-load rule; six slaves at 500 ms take about 45 percent and fit. Multiply slaves by wire time, then divide by the poll period.