How-to
Connecting One HMI to Two PLCs With Independent Modes
Short answer
Yes. Configure one HMI device connection per PLC and bind each tag to its own controller; inside each PLC, run master-mode program A on bit M0 and slave-mode program B on bit M1, kept mutually exclusive. Set communication supervision per connection so the separated panel raises no alarm, and the HMI controls both PLCs whenever the panels are joined.
On this page
- Can one HMI control two PLCs at the same time?
- Should the two PLCs connect over RS-485 or Ethernet?
- How do I configure a separate HMI connection for each PLC?
- How do I split each PLC's program into master and slave modes?
- What must happen when both mode bits are on or both are off?
- How do I stop the HMI showing a communication error when one PLC is disconnected?
- How do I commission both panel states end to end?
- Questions asked
One HMI can read and write two PLCs if you treat the job as two coordinated tasks: per-controller communication on the HMI side, and a mode-selectable program inside each PLC. Configure one device connection per PLC and bind every tag to its own connection. Inside each controller, run master-mode program A on bit M0 and slave-mode program B on bit M1, kept mutually exclusive. Supervision is set per connection, so the PLC in the separated panel raises no communication error, and the HMI controls both controllers whenever the panels are joined.
Can one HMI control two PLCs at the same time? #
Yes — one HMI can read and write both PLCs, provided you configure two device connections in one project and bind every tag to the controller it belongs to; the two controllers never talk to each other directly, the panel link carries everything.
Write the two operating states down before touching software, because every later setting serves one of them:
| Panel state | Control path | HMI expectation |
|---|---|---|
| Separated | HMI runs the PLC in its own panel; the other PLC runs from its local button | Poll only the local PLC; no alarm from the missing one |
| Joined | HMI writes commands and reads values to and from both PLCs | Every screen object resolves to the correct controller's connection |
The words master and slave in this design name the two program modes inside each controller — they are not a PLC-to-PLC protocol. The mirror problem, several operator panels sharing one machine, is a different design; see connecting two HMI panels to control one machine.
Should the two PLCs connect over RS-485 or Ethernet? #
Use Ethernet when both controllers have ports, because the two connections stay independent and losing one cable disturbs only that one; use RS-485 when only serial ports exist, as one multidrop bus with the HMI as its single master.
TIA-485, the RS-485 standard, permits many stations on one differential pair but only one driver enabled at a time — which is why the HMI must be the only master, and why a second polling device on the same bus shows up as timeouts, the failure behind an HMI Modbus timeout caused by a PLC master/slave conflict. Each PLC then needs its own station or unit address; a workable assignment is 1 and 2, with the HMI as master. For the serial route in general — two-wire versus four-wire, termination, protocol choice — the background is in choosing the RS-485 protocol for one HMI and multiple PLCs.
The Modbus over Serial Line specification requires a silent interval of at least 3.5 character times between frames; at and below 19200 baud that interval scales with the character time, and above 19200 baud it is fixed at 1.75 ms. The interval is part of the price of a serial scan, so calculate it before promising anyone an update rate:
- Character time at 19200 bit/s with 11-bit characters: 11 ÷ 19200 = 0.573 ms
- One read of 10 holding registers: 8-byte request + 25-byte response = 33 bytes = 363 bits; 363 ÷ 19200 = 18.9 ms on the wire
- Both mandatory silent intervals: 2 × 3.5 = 7 characters = 77 bits; 77 ÷ 19200 = 4.0 ms
- One block from one PLC: 18.9 + 4.0 = 22.9 ms; the same block from both PLCs: 45.8 ms
That 45.8 ms is the calculated floor for line time alone — device response time, the driver's polling interval, retries and screen refresh all add to it. For mode commands and process values the floor is comfortable; if you need fast refresh or genuinely independent links, put each PLC on Ethernet with its own address. With three stations on the bus, loading is not the constraint: terminate both physical ends of the pair and bias it to a defined idle state.
How do I configure a separate HMI connection for each PLC? #
Create two devices in the HMI's communication configuration — one per PLC — then assign each tag to its device; a working connection to the first controller proves nothing about the second controller's tags.
- Add the first device: pick the driver for that controller family, then its address — a unit address on the serial bus or an IP address on the network.
- Add the second device the same way, with a different unit address or its own IP address.
- Set polling and supervision per device, not globally, so the two controllers can be treated differently later.
- Build the tag list in two groups, one per device, and check every address against that controller's program; grouping each controller's data into one contiguous block lets the driver fetch it in fewer transactions.
- Point each screen object at a tag from the correct group — values and commands for controller 1 come only from its tags.
- Test with distinguishable values: write a different known number into each controller's test register and confirm only the matching screen object moves.
A tag bound to the wrong device is the most common fault in this layout: the link is healthy, the value is right, and it still comes from the other PLC.
How do I split each PLC's program into master and slave modes? #
Split each controller's logic into two subprograms — program A for master mode and program B for slave mode — and switch them from the main program with two mutually exclusive bits: M0 on runs program A, M1 on runs program B.
Put input reads and output set/reset logic inside the subprograms, so the active mode owns the outputs and the inactive one touches nothing. Decide where M0 and M1 come from in each state: an HMI mode command when the panels are joined, and the local selector or button in the separated panel, where the controller must be able to enter slave mode with no HMI in the loop. On the screen side the same requirement appears as button behavior, and the pattern is covered under configuring mutually exclusive buttons on an operator panel.
What must happen when both mode bits are on or both are off? #
Make both-on and both-off defined states: selecting a mode resets the other bit, and both bits off selects a stopped or idle behavior — never let two subprograms run at once.
Drive the selection as sealed-in logic: the master command sets M0 and resets M1 in the same execution, and the slave command sets M1 and resets M0. Both bits on then becomes impossible instead of merely unlikely, and both bits off is your power-up state, with outputs held off until an operator picks a mode. The reason to insist on this is output ownership: with two subprograms writing the same coil, the last write in the scan wins, so a reset you issued can be overwritten within the same cycle — the classic shape of a PLC bit reset that never executes under overlapping conditions.
Mode bits and HMI commands are operational control, not safety functions: emergency stop and guarding stay hardwired and must never depend on the HMI link being alive.
How do I stop the HMI showing a communication error when one PLC is disconnected? #
Configure it in the HMI, not the PLC: give each device connection its own supervision setting and switch the disconnected controller's connection to passive with a control bit, so polling stops and no alarm appears.
The setting lives in the HMI project's device or connection configuration, and in packages that support it a connection carries an active/passive state a bit can toggle — a behavior the PLC cannot reproduce on its side. Define who sets that bit: a screen action when the panels are separated, or a join signal when they are plugged back together, after which polling resumes on its own. If your engineering tool offers no per-device control, keep the alarm but confine it; never disable supervision for every device, because that hides real faults on the controller that must stay connected.
The reverse direction is worth building while you are there. The HMI toggles a heartbeat bit every 1 s, and each controller runs a 3 s timer that every toggle resets; three missed toggles — 3000 ÷ 1000 = 3 — mark the HMI as absent, which lets the separated panel's controller drop HMI authority cleanly and fall back to its local button.
How do I commission both panel states end to end? #
Commission in three passes — separated, joined, and the transition between them — and in every pass check four things: mode selection, tag-to-controller ownership, connection state, and local control.
- Panels separated: confirm the HMI reads and writes only the controller in its panel, and the other runs its slave-mode program from the local button.
- Still separated: set the disconnect bit, remove the second link, and confirm no communication alarm appears while the local controller keeps updating.
- Panels joined: connect both links, confirm both devices show active, and read a different known value from each controller.
- Still joined: issue a mode command to each controller and verify program A or program B owns the outputs, with local-button behavior as designed.
- Fault test: break one joined link and confirm the other controller stays controllable and any indication names the correct device.
- Illegal-state test: force both mode bits on together and confirm the interlock resets one; clear both and confirm the idle state with outputs off.
- Transition test: separate and rejoin the panels and confirm the supervision bit, the mode state and the heartbeat all recover without a power cycle.
A screen value alone proves nothing: a number can keep updating while the command path is dead, so each pass ends with a write that the machine visibly answers.
Questions asked
Do the two PLCs exchange data with each other in this setup?
No. The HMI is the only link between them, and master and slave name program modes inside each controller, not a controller-to-controller protocol. Separated, each panel is fully standalone. If you later need the controllers to share data without the HMI, that is a separate physical link and protocol you add and commission on its own.
Can both PLCs use the same M0 and M1 bit addresses?
Yes. M0 and M1 are internal bits in each controller's own memory, so the same numbering in both programs refers to two different physical bits. Keeping the addresses identical lets one mode screen write the same command pattern to both controllers over their separate connections, which halves your tag and screen work.
What can I do if my HMI software has no per-connection disable?
Keep supervision on, but map the disconnected controller's communication state to one clearly labeled screen indicator instead of a popup alarm, so operators see an intentional offline condition rather than a fault. Do not switch supervision off for every device: that also hides genuine failures on the controller that must stay connected.
Is it safe to point two HMI buttons at the same PLC tag?
Yes. Multiple screen objects writing one controller tag is a normal, supported practice, and the controller applies the writes in the order they arrive. The risk is an operator race, not data corruption, so for mode commands use exclusive button logic: pressing master resets slave in the same action instead of leaving both set.
How much slower is the HMI with two PLCs on one serial bus?
Roughly twice the serial time per scan of the same block. The calculated floor above is 22.9 ms for one 10-register read from one controller at 19200 baud, so reading that block from both controllers needs 45.8 ms of line time before device response and driver overhead. On Ethernet the two connections run independently at link speed.