IMDHMIControls LibraryShop main store

How-to

Set up a QJ71MT91 as Modbus TCP client with scattered registers

Industrial networks Published 6 min read

Short answer

Run the QJ71MT91 as a Modbus TCP client to the remote I/O interface on port 502, one connection at a time, and keep the SCADA host as a client of the module's server function. Split the slave's scattered register table into bounded requests grouped by object type and direction, convert references to zero-based offsets, and stage every network value in D registers instead of X and Y.

On this page
  1. Assign the client and server roles
  2. Configure the client connection in GX Configurator-MB
  3. Turn Modbus references into protocol addresses
  4. Split the scattered map into bounded requests
  5. Land the data in D registers, not X and Y
  6. Bring the SCADA online as a client of the module
  7. Commission in this order
  8. Questions asked

Set the QJ71MT91 to client (master) for the remote I/O interface at 10.1.1.201, and leave the SCADA host at 10.1.1.150 as a client of the module's server function — do not make the module poll the SCADA. Bring up one connection at a time in GX Configurator-MB, with TCP port 502 at both ends and unit ID 1 on both servers, which is fine because each connection targets a distinct IP address. Split the slave's scattered register table into small requests grouped by object type and direction, and land every network value in D registers before your logic touches it.

Assign the client and server roles #

Modbus TCP renamed the old serial roles: the master is the client, the end that opens a TCP connection and sends requests; the slave is the server that listens. The QJ71MT91 can fill either role, so decide per connection before configuring anything.

Endpoint Role Decision
Remote I/O interface, 10.1.1.201, unit ID 1 QJ71MT91 is the client Field I/O never initiates; the controller owns the polling schedule
SCADA host, 10.1.1.150, unit ID 1 QJ71MT91 is the server SCADA drivers are data-acquisition clients; expecting the SCADA host to listen and serve a PLC reverses the normal pattern

One entry in the proposed map lists 3x input registers as read/write. Treat that row as holding registers: input registers are read-only in the Modbus object model, so a writable analog value can only live in 4x, served by FC03 reads and FC06 or FC16 writes.

Configure the client connection in GX Configurator-MB #

  1. Give the module an address on the same 10.1.1.x network as both targets, with the mask that network runs. Both servers sit beside it, so no gateway is involved.
  2. Create connection 1 as MODBUS/TCP to destination IP 10.1.1.201, TCP port 502. The port must match on the client definition and inside the server, or the TCP connection fails while ping still succeeds.
  3. Define a single polling request on that connection: holding registers, start offset 0, 10 words, destination D2000.
  4. Write the settings to the module and restart it by the procedure in the MODBUS/TCP Interface Module User's Manual (SH080446), then confirm the connection establishes before adding anything else.
  5. Add the remaining requests from your grouped list, one object type and one direction per request.

Turn Modbus references into protocol addresses #

The leading digit of a reference is a documentation convention; it never travels on the wire. The request carries a zero-based protocol address.

Range Object Access Functions
000001-065536 Coils Read/write bits FC01, FC05, FC15
100001-165536 Discrete inputs Read-only bits FC02
300001-365536 Input registers Read-only words FC04
400001-465536 Holding registers Read/write words FC03, FC06, FC16

Subtract the class base and 1: reference 40001 maps to protocol address 0, 40025 to 24 because 40025 − 40001 = 24, 40044 to 43, and discrete input 10033 to 32. Enter that offset, not the reference, as the request start address. Some device tables count from 1 instead of 0, so force one point you can watch and check which side of the boundary it lands on before trusting the whole map.

Split the scattered map into bounded requests #

Group points that share all four of these: the same connection, the same object type, the same direction, and contiguous implemented addresses. Keep every read at or below 125 words and every multi-register write at or below 123 words; bit reads top out at 2000 and coil writes at 1968. Those are the Modbus application-layer ceilings, and a well-grouped map stays far under them.

For gaps, use this working rule: include a gap inside one request only when the server's own table marks every intervening address as implemented, and only when the gap is 8 words or fewer. Eight dead words cost 16 bytes of payload, while a second transaction costs a full network round trip. A longer gap gets its own request.

Worked example, with an illustrative register list: the I/O interface implements holding registers 40001-40010, 40025-40032, and 40044-40060.

  • One request covering 40001-40060 asks for 60 registers and crosses two unimplemented spans, 40011-40024 (14 addresses) and 40033-40043 (11 addresses). The server answers with exception 02 and delivers nothing, not even the implemented words.
  • Split instead into three requests: offset 0 with 10 words into D2000-D2009, offset 24 with 8 words into D2010-D2017, and offset 43 with 17 words into D2018-D2034. Arithmetic: 40044 − 40001 = 43 and 40060 − 40044 + 1 = 17, so 10 + 8 + 17 = 35 words in three transactions, each far below the 125-word ceiling.

Both gaps in the example exceed 8 words, so splitting is the right call; an implemented 6-word gap would be cheaper to read through than to skip. The same mechanism is why a read that crosses a register map gap fails even when most of its range exists.

Land the data in D registers, not X and Y #

The proposed map sends coils to Y devices and contacts to X devices. Resist that. X devices are the local input image refreshed by the PLC's I/O scan, and Y devices are outputs your program owns; a client refresh that writes Y directly bypasses every interlock you wrote around that output. Stage words in D registers and discretes in M devices or D bits, then let ladder move values to and from real I/O under logic you control.

One safety note belongs here: coils on a remote I/O interface drive real field outputs, so a remote coil write is a machine command in the same sense as a local output coil. Gate it in logic and never pass a network value straight through. The same discipline governs SCADA writes reaching output registers over Modbus, and it is why polled Modbus data behaves differently from remote I/O even when the architecture diagram looks similar.

Bring the SCADA online as a client of the module #

If the module already answered in server mode with default parameters, that test proved its address, cabling, and TCP stack, so keep the function. The module's manual presents master and slave operation as separate settings on one module: run the client polling to the I/O interface and the server map for the SCADA host side by side. Point the SCADA's Modbus TCP driver at the module as a client, reading the D block your polling fills, exposed as holding registers. Setpoints the SCADA writes arrive there too; consume them in logic like any operator entry.

Commission in this order #

  1. From a laptop on the same subnet, read one known register of the I/O interface with a Modbus TCP test utility. This proves the server's address, identifier, and port before the PLC is involved.
  2. Bring up connection 1 with its single 10-word request and compare D2000-D2009 against the laptop's values.
  3. Add the remaining read groups, checking each request's completion status in the module's buffer memory before adding any writes.
  4. Add writes as event-triggered transactions, separate from the polling list, so a write never waits behind the full read schedule.
  5. Enable the server map for the SCADA host and have it read the same D block the client fills.
  6. Raise polling rates or add connections last, after every point is proven.

Questions asked

Can the QJ71MT91 run as client and server at the same time?

Yes. The module's manual presents master and slave operation as separate settings on one module, so you run client polling to the field device and a server map for the SCADA host side by side. Configure each side on its own, write the settings, and restart the module by the documented procedure before testing either role.

Both servers use unit ID 1. Is that a conflict?

No. The unit ID only has to be unique within the server being addressed, and each client connection targets a distinct IP address. Your polling connection to the I/O interface and the SCADA host's connection to the module are separate TCP conversations, so unit ID 1 on both servers is fine as long as each connection has one clear destination.

What happens if one request spans unimplemented registers?

The server answers with exception 02 and delivers nothing, not even the implemented words inside the range. That is why a single request covering a scattered map with gaps fails while most of its addresses exist. Split the range into bounded requests that cover only implemented, contiguous addresses.

My read of 40001 shows the value documented at 40002. Why?

The leading digit of a reference is a documentation convention; the request carries a zero-based protocol address. Reference 40001 maps to protocol address 0, so an off-by-one like this usually means one side of the transfer counted from 0 while the other counted from 1. Force one point you can watch and check which side of the boundary it lands on, then apply the same offset to the whole block.

Which tool configures the client, GX Developer or GX Configurator-MB?

Use GX Configurator-MB to define the connections, polling requests, and the server map for the module, then write the settings and restart the module by the procedure in the MODBUS/TCP Interface Module User's Manual. GX Developer remains your ladder environment; the logic that consumes the staged D registers lives there, not in the configuration tool.

Keep reading

  • How-to

    Connecting third-party Modbus TCP devices to a Modicon MC80

    Yes. A Modicon MC80 under Control Expert Classic exchanges data with any third-party Modbus TCP device through explicit READ_VAR and WRITE_VAR calls plus the device's register map — there is no ESD or EDS import, no IO Scanning and no DTM support. Run the MC80 as the TCP client, keep the exchange in the coil and holding-register tables, and latch each result in the reader so a 16 ms update survives a slower PLC poll.

    Industrial networks

  • How-to

    Setting up a CODESYS Modbus TCP client to talk through a gateway

    In CODESYS, Modbus TCP is an application library, not a fieldbus add-on: reference the Modbus TCP Client SL library, point the client at the gateway's IP on port 502 with the gateway's unit ID, and split the map into contiguous blocks of at most 125 registers per request. Every value is a cached copy whose worst-case age is the gateway poll cycle plus your client's map refresh time, so budget both against the freshness the process needs.

    Industrial networks

  • Troubleshooting

    What to do when a Modbus TCP server lacks FC22 support

    When a SCADA client sends FC22 (Mask Write Register) to a server that does not implement it, the reply is exception 01, Illegal Function. A compiled server library cannot be edited to add the function, so the fix is client-side: map the points as coils, write whole registers, or use FC23, and give every shared register a single writer.

    Industrial networks