IMDTouchKnowledge BaseShop main store

How-to

Connecting an XBTGT HMI to an M241 PLC over Modbus TCP

HMI and touchscreens Published 5 min read

Short answer

Delete the Generic Modbus TCP slave from the M241 device tree and activate the Modbus server on the controller's Ethernet interface instead — that slave makes the M241 a client, so both devices poll and neither answers. Then map Vijeo Designer driver address 40001 to PLC word %MW0, keep TCP port 502 open between panel and controller, and shift the address map by one word if a test read lands one register off.

On this page
  1. What the Generic Modbus TCP slave actually does
  2. Activating the Modbus server on the M241
  3. Network reachability and port 502
  4. Worked example: verifying 40001 against %MW0 on an XBTGT 5330
  5. Choosing between the Modbus TCP driver and the Machine Expert driver
  6. Final verification of the HMI-to-PLC link
  7. Questions asked

The device alarm in Machine Expert comes from the Generic Modbus TCP slave sitting in the M241 device tree. That entry makes the controller a Modbus client polling a remote server, and the Magelis XBTGT 5330 with the Modbus TCP driver in Vijeo Designer is a client too, so neither side answers the other. Industrial Ethernet Manager stays happy because both devices respond at their own addresses — it never tests the Modbus session. Delete the slave, activate the Modbus server on the M241's Ethernet interface instead, then map driver address 40001 to PLC word %MW0 over TCP port 502. The steps below fix the roles, prove the path, and verify the map end to end.

What the Generic Modbus TCP slave actually does #

A slave node added under the Ethernet interface does not open the M241 to an HMI. It configures the controller as a Modbus client that polls the IP address entered in the node and expects a server to answer. Your XBTGT 5330 polls the PLC the same way, so the M241's polls land on a device that never serves them and Machine Expert raises the device alarm.

Some installations limp along with the slave by declaring every input and output by hand in its channel list. That reconciles the two sides one register at a time and breaks again with each new tag. The roles here are fixed: the M241 is the server, the HMI is the only client.

Child devices under a controller always give the controller the master role toward that child, which is why adding a generic CANopen device to an M241 is the right pattern for a fieldbus slave and the wrong one for an HMI.

Activating the Modbus server on the M241 #

Do the downloads with the machine in a safe state: a download restarts the application, and outputs can move as it comes back.

  1. In the Machine Expert device tree, select the Generic Modbus TCP slave under the M241's Ethernet interface and delete the node.
  2. Rebuild and download the application, put the controller in run, and confirm the device alarm is gone before touching anything else.
  3. Open the Ethernet interface configuration — the interface itself, not a child device — and enable its Modbus server option.
  4. Download again and confirm the interface still carries the IP address you will enter in the HMI driver, with the controller running alarm-free.
  5. In Vijeo Designer, create the Modbus TCP equipment with that address; leave the unit ID at its default and change it only if the final test shows no response at all.

Network reachability and port 502 #

A healthy report for both devices proves each one answers at its own address. A Modbus TCP session needs three more things: both devices in the same subnet with the same mask, or a gateway set in the HMI when they are not; unique addresses on the network, because a duplicate IP shows up as a link that drops and returns; and the default Modbus TCP port 502 open from panel to controller on any managed switch or firewall between them.

If the session still fails with the server active, M241 and Magelis HMI communication troubleshooting walks the Ethernet-side faults for this controller-and-panel pairing.

Worked example: verifying 40001 against %MW0 on an XBTGT 5330 #

Inputs, each from the project as built:

  • HMI: XBTGT 5330 running a Vijeo Designer project with the Modbus TCP driver; variables declared as external, so they carry driver addresses rather than PLC symbol names.
  • PLC: M241 with the server active from the steps above, at an example address of 192.168.1.2 — substitute your controller's address.
  • Test point: %MW0, an unused word in the M241 program, read on the HMI by an Integer external variable at driver address 40001 on a numeric display.

Rule in words: with the driver's usual 1-based register numbering, the %MW index equals the driver address minus 40001.

Arithmetic:

  • 40001 − 40001 = 0, so address 40001 reads and writes %MW0.
  • 40010 − 40001 = 9, so data placed at 40010 for the next screen lands on %MW9, and the pattern repeats across the block.

Test:

  1. In the Machine Expert online view, write a value you will recognize at once into %MW0.
  2. The HMI display bound to 40001 must show that value without a screen change.
  3. Write from the HMI numeric input and confirm the same word moves in the online view.

Decision: both directions tracking locks the mapping — build the rest of the screens on it. A display off by exactly one word is a numbering-base mismatch, not a fault: shift the whole address map by one in the direction the test shows, entering 40000 for %MW0 when the display read the word above, and leave the PLC program alone. A display that is empty or randomly wrong sends you back to the server and port checks above.

Keep everything the HMI shares in one contiguous %MW block: the driver then groups neighbouring registers into fewer requests, which an old terminal shows as visibly faster screens.

Choosing between the Modbus TCP driver and the Machine Expert driver #

Vijeo Designer also offers a Machine Expert protocol driver for Schneider controllers that reads variables by name and removes the address table. Use it when the project stays all-Schneider and you want symbolic access.

Stay on Modbus TCP when the register map is a fixed interface other equipment must honour, or when the same driver has to reach non-Schneider devices. A plain 4xxxx map also outlives the panel: selecting a Modbus TCP HMI panel for an existing controller keeps the same driver and addresses when this terminal retires.

The XBTGT 5330 is a deprecated target, so confirm the Vijeo Designer version you hold still lists both the terminal and the driver you choose before building screens.

  1. Controller in run, no device alarm in Machine Expert.
  2. HMI started, no communication error banner after the driver connects.
  3. Write %MW0 from the online view; the HMI display shows it.
  4. Write from the HMI numeric input; the same word changes in the online view.
  5. Pull the panel's Ethernet cable: the HMI must flag the loss, then refresh the values on reconnect without a power cycle.

If the banner stays up with the cable in, the unit ID in the equipment entry and the port 502 path are the two things left to check. Tags that connect but never move are a different fault, covered in why HMI indicators stay off over Modbus RTU polling.

Questions asked

Why does the Generic Modbus TCP slave work for some people?

It can be made to work by declaring every input and output by hand in the slave's channel list, which forces the M241 to poll exactly the registers the HMI touches. It stays the wrong role: each new tag needs an edit on both sides. The activated server exposes the %MW words directly, with no per-tag declarations to maintain.

Does a healthy status in Industrial Ethernet Manager mean the Modbus link will come up?

No. It proves each device answers at its own IP address. A Modbus TCP session also needs the server active on the M241 and port 502 passing between the two addresses. Check those two before changing anything in the driver.

Can the XBTGT 5330 still be programmed now that it is deprecated?

The terminal runs whatever project your Vijeo Designer version downloads to it. Before building new screens, confirm that version still lists the XBTGT 5330 as a target and offers the driver you plan to use, and archive the installer with the project while you have both.

Is TCP port 502 the only port the connection needs?

For the Modbus TCP data session, yes: the HMI opens a connection to the controller on 502, so any managed switch or firewall between them has to allow it. Diagnostic and web tools may use other ports, but the HMI link itself lives on 502.

Should I switch to the Machine Expert driver instead of Modbus TCP?

Switch if the project stays all-Schneider and you want variables by name, since the address table disappears. Stay on Modbus TCP when the register map is a fixed interface specification or the driver must also reach non-Schneider devices, because a plain register map survives changes of panel and controller.

Keep reading

  • Selection guide

    Planning an HMI Terminal Replacement From an Older Operator Panel

    Decide an operator-terminal replacement on installed cost — the terminal, cutout adaptation, application software, engineering, commissioning, downtime and a spare — never on terminal price alone. Measure the opening against the replacement's documented cutout range and count displays before ordering: a slightly smaller terminal needs a bezel adapter, and a large converted application can force the higher-performance model. Convert in the same brand when the source project opens cleanly; rebuild cross-brand when you accept the extra engineering hours for source control.

    HMI and touchscreens

  • Troubleshooting

    Fixing HMI Modbus Device No Response Over RS-485

    Device no Response means the slave never returned a valid frame to that request. When a PC polling tool reads the same scanner, the bus is probably carrying two masters: run one master at a time, then copy the known-good read's serial settings, station address, and register offset into the HMI.

    HMI and touchscreens

  • How-to

    Testing HMI Simulation Against a Live PLC

    A standalone HMI simulator proves screens and navigation, not communications. Test against a live controller only through a documented online-simulation mode or a physical panel, and verify every read at two data states and every write at the controller before release.

    HMI and touchscreens