Explainer
Which CODESYS module reads Modbus TCP I/O on an edge controller
Short answer
On a CODESYS edge controller, the module that reads Modbus TCP I/O is the Modbus TCP Master SL library the runtime vendor preinstalls; the I/O appears as polled registers, not native devices. EtherNet/IP racks need the separately licensed EtherNet/IP Scanner SL. Verify function code, start address, register count, word order and unit ID against the block's printed map before the logic trusts a value.

On this page
- Which CODESYS module talks Modbus TCP on an edge controller?
- Does remote I/O become native CODESYS I/O in the project?
- When does the EtherNet/IP scanner replace the Modbus master?
- What do you verify against the register map first?
- How much network traffic does a polled I/O block cost?
- What timeout and poll period should the slave entry use?
- What happens when a polled I/O block stops answering?
- Which module wins for each kind of I/O?
- Questions asked
On a CODESYS edge controller the module that reads Modbus TCP I/O is the Modbus TCP Master SL library — the one the runtime vendor preinstalls in the image. You do not add the remote I/O rack to the project tree as native devices. You add one Modbus TCP master, create a slave entry for each I/O block, and poll the block's registers on the cycle your task sets. When the hardware speaks EtherNet/IP instead, the module changes: the CODESYS EtherNet/IP Scanner SL is a separate store purchase. Either way, unit ID, function codes, the register map and the timeout all come from the I/O block's own documentation, and a green connection proves none of them. The sections below take the decision and the verification in the order you meet them on a real job.
Which CODESYS module talks Modbus TCP on an edge controller? #
It is the Modbus TCP Master SL driver: the CODESYS store lists it as a license-only product for runtimes with a corresponding preinstalled library, so the runtime vendor's image decides whether the code is already on your controller and under which license. That wording settles the purchase question — the product for sale is the license alone, because the library itself is preinstalled in the runtime, and a vendor who built the Modbus master into the image has already done the integration. The driver's data sheet states that it supports all Modbus function codes for exchanging I/O data, so one library covers reads and writes to remote I/O blocks, meters and drives. There is no second CODESYS module for Modbus TCP: the decision is this library or a different protocol, never a different Modbus module.
Does remote I/O become native CODESYS I/O in the project? #
No — the rack appears as one Modbus TCP slave entry under the master, and its data arrives as polled registers that you map into your own variables; no object in the project tree represents the rack's individual I/O modules. The mapping is manual, which is where projects go wrong. The slave entry exposes the block's registers in the order its map defines and hands them to your task as holding and input register data — the same addressing the explanation of CODESYS %IW0 for a Modbus TCP holding register walks through — and naming, typing and scaling each one is your job. Treat the register map as the only contract between block and logic: connection state tells you the transport works, never that a register means what you think it means.
When does the EtherNet/IP scanner replace the Modbus master? #
When the I/O hardware speaks EtherNet/IP rather than Modbus TCP: the Modbus master cannot read an EtherNet/IP adapter, so the module of record becomes the CODESYS EtherNet/IP Scanner SL, which the store sells separately from the runtime. The scanner's store page documents the detail that makes it practical across a fleet: the license can be stored on a CODESYS Key, a USB dongle, and moving it to another controller is a matter of replugging the Key. Choose by protocol, not preference — the rack adapter's documentation names what it speaks, and that one word decides the module. A runtime can carry both modules when a machine mixes Modbus TCP meters with an EtherNet/IP rack.
What do you verify against the register map first? #
The five lines of the block's printed map: function code, start address, register count, data type with word order, and unit ID — check each against the device's own table before a single value reaches the logic. Function codes split reads from writes: FC3 reads holding registers, FC4 reads input registers, FC5 and FC15 drive coils, FC16 writes registers. The master's data sheet says all Modbus function codes are supported for I/O exchange, so the map's codes will run — the risk is pointing them at the wrong table or reading a count the map never defined. A device that states no port listens on the Modbus TCP default, 502. For unit ID, a Forge thread on Modbus TCP slave setup records a master that accepts slave IDs only from 1 to 254 and cannot set 0, so take the block's documented ID and expect nothing below 1. Word order is the trap that survives every connection test; the FAQ below holds a two-register test value that exposes it in one read.
How much network traffic does a polled I/O block cost? #
For an example block of 12 input registers read and 2 output registers written every 100 ms, the link carries 740 bytes per second of Modbus payload and about 27 kbit/s with TCP, IP and Ethernet framing — bandwidth never decides this design; the register map does. The inputs are illustrative — your block's map sets the real ones — but the arithmetic is the check to repeat for any block:
- Read 12 registers with FC3: request 7-byte MBAP header plus 5 bytes = 12 bytes; response 7 + 2 + 24 data bytes = 33 bytes; exchange 45 bytes.
- Write 2 registers with FC16: request 7 + 6 + 4 data bytes = 17 bytes; response 7 + 5 = 12 bytes; exchange 29 bytes.
- One 100 ms cycle moves 45 + 29 = 74 payload bytes, so 10 cycles per second put 10 × 74 = 740 bytes per second of Modbus data on the wire.
- Framing adds roughly 66 bytes per frame across four frames per cycle: 10 × (74 + 4 × 66) = 3,380 bytes per second, about 27 kbit/s — 0.03 percent of a 100 Mbit/s link.
That leaves room to poll several blocks on one link; the binding constraint is the block's reply time, which the timeout below budgets. Put the write transaction behind the read in the same task, lowest priority last — the same queueing problem as speeding up Modbus RTU writes behind polled reads on a serial link.
What timeout and poll period should the slave entry use? #
Set the slave's Time Out equal to one poll period and a dead block raises its error within two: with a 100 ms poll and a 100 ms Time Out, the first timeout fires 200 ms after the last good reply. Both settings live on the slave device's page: on the documented Modbus_TCP_Slave device you enter the block's IP address, and when Time Out is enabled the runtime applies it to that slave's mapped data. The basis for one poll period: a healthy block answers well inside it, so no good reply is ever condemned and no two requests to the same block overlap; if the process needs faster reaction, shorten the poll period, not the timeout, because a timeout below the reply time makes healthy blocks flap and teaches the logic to ignore the error.
What happens when a polled I/O block stops answering? #
The request times out, the slave entry raises its error, and the mapped registers freeze at their last values — which is why the error output, not the register values, is the only signal your logic may trust. The two failure shapes differ. A dead link fails everything at once: every register of that slave goes stale together, within one timeout of the cable coming out. A wrong address or an unsupported function code returns a Modbus exception on that transaction while the rest of the slave keeps answering, so one variable misbehaves and the rest look healthy — the more dangerous shape, because it hides. Request-level failures on the CODESYS master carry their own codes, and the article on why a CODESYS Modbus master gives error 150 or 153 takes that family apart. One safety note: output registers written across a frozen link can sit energized, so write them from logic that watches the slave's error output, never from a screen or a force, with the same interlocks as safe Modbus writes to PLC output registers from SCADA.
Which module wins for each kind of I/O? #
Modbus TCP I/O takes the runtime's Modbus TCP master, EtherNet/IP I/O takes the separately licensed CODESYS EtherNet/IP Scanner SL, and any other fieldbus gets a gateway in front, because no CODESYS module reads a foreign rack directly. The decisions per case:
- A remote I/O block with a printed Modbus TCP map: the preinstalled master, one slave entry per block, its documented unit ID on port 502, the map verified line by line, Time Out at one poll period.
- An EtherNet/IP adapter rack: the scanner bought as a license, stored on a CODESYS Key when it must move between controllers.
- A rack that speaks PROFINET, CAN or serial: a gateway to Modbus TCP in front of it, with the master pointed at the converter the way the walkthrough of a CODESYS Modbus TCP client through a gateway sets it up.
Whatever the module, the bar is the same: a green connection is capability, and the register map compared value by value against the block's documentation is verification — finish the second before the logic acts on the first.
Questions asked
Can I test the register mapping before the remote I/O hardware arrives?
Yes. Point the slave entry's IP address at a Modbus TCP simulator on your bench PC, write the values the printed map calls for into each address, and read them back in the CODESYS variables. The simulator appears as one more slave entry under the master; no I/O module object ever shows up in the project tree.
How long can a bench test run before a license is needed?
For the Modbus TCP products on the CODESYS store, the Server SL page documents demo mode: the software runs two hours without a license, then stops. Use a window like that for bench verification only, and check the store page of the specific SL product you intend to license, because each product carries its own terms.
How can I see that two registers arrive word-swapped?
Write a known 32-bit test value into two adjacent registers with the block's own tools and read the pair back as one variable. A value of 1000 that reads back as 65,536,000 has its two words exchanged: 1000 sits as 0x03E8 in the low word, and swapping the words turns it into 0x03E80000.
Does one master poll several I/O blocks at the same time?
Yes. The master keeps one slave entry per block, each with its own IP address, unit ID and timeout. The poll period is per entry, so four blocks polled at the example's rate put four times the example's traffic on the wire and four times the transactions in the task, and each entry is budgeted the same way.
