Explainer
CODESYS 2.3 Modbus serial master: library choice and task setup
Short answer
On the 750-8208 under CODESYS 2.3 you get a Modbus serial master two ways: the integrated configurator under Resources, PLC Configuration, Modbus-Master[FIX], or the Modb_l05.lib function blocks. Once any task is configured, PLC_PRG no longer runs automatically, so you must assign it explicitly or a correct mapping looks idle.

On this page
Coming from e!COCKPIT, the question is which CODESYS 2.3 library replaces the Modbus Serial Master you were using. The answer: on the 750-8208 you have two documented paths, the integrated Modbus configurator at Resources, PLC Configuration, Modbus-Master[FIX], and the Modb_l05.lib library of serial master function blocks. Pick the configurator when the runtime should own the polling; pick Modb_l05.lib when you want the poll in your own program. And one trap catches almost everyone who moves to CODESYS 2.3: as soon as your project contains a task configuration, PLC_PRG stops running automatically, so a perfectly correct Modbus mapping sits idle until you assign the main program to that task.
The two master paths #
CODESYS 2.3 on the PFC200 series gives you a serial Modbus master either as a configuration object or as code:
| Path | Where it lives | Who runs the poll | Fits when |
|---|---|---|---|
| Integrated configurator | Resources tab, PLC Configuration, Modbus-Master[FIX] | The runtime, per the mapping you enter | You want registers mapped to variables without writing comm code |
| Modb_l05.lib | A library you add to the project, with serial master function blocks | Your program, calling the blocks cyclically | You need per-port control, dynamic slave addressing, or logic you can port |
The configurator is the faster path for a fixed set of registers on one or two slaves: you enter slave address, function, register range and framing in a tree, and the runtime polls for you. Modb_l05.lib is the older, code-first path; the function blocks are similar in purpose to the e!COCKPIT Modbus Serial Master library, instantiated per serial port, with the request parameters as block inputs. If you instantiate a port and the block never completes, the usual cause is a port instantiation or parameter mismatch; the details of getting the port handle right are covered in the guide on WAGO modb_l05.lib serial port instantiation in CoDeSys V2.3, and a related worked example of driving a WAGO 750-653 Modbus RTU module from CODESYS shows the same request-and-response pattern from the master's side.
Configuring the integrated Modbus-Master[FIX] #
- Open your CODESYS 2.3 project and switch to the Resources tab.
- Double-click PLC Configuration and find the Modbus-Master[FIX] entry in the tree.
- Add the serial device and enter the parameters the connected device requires: slave address, function code, start register and quantity, and the serial framing (baud rate, parity, stop bits) both ends share.
- Map each register range onto a variable. For a multi-register block, right-click the variable in the tree and use the context-menu entry number of items to turn the destination into an array of that length, instead of declaring one variable per register.
- Download and watch the mapped variables update while the slave responds.
Never guess framing or addressing. Those values come from the connected device's manual; the configurator only carries them. If you need several slaves on one line, keep the total transaction time in mind — the same arithmetic used when you poll many Modbus RTU slaves from one serial master applies to the configurator's polling as well, because the runtime walks the configured requests sequentially on the port.
Why a correct mapping looks idle: the task trap #
In CODESYS 2.3, PLC_PRG runs automatically only while the project has no task configuration. Add one task — anything, even an empty one — and the runtime executes only what is assigned to tasks. Your Modbus mapping and your main program are both fine; the program just never runs.
Worked example. Suppose you mapped 20 holding registers from a slave into an array of 20 words, and the values never change. Check the task configuration:
- Open Resources, Task Configuration. If any task exists, PLC_PRG must be listed under it.
- Assign PLC_PRG to the task, set a cycle time you can verify — for example 100 ms.
- Download and run. In one second the task executes 1000 ms / 100 ms = 10 cycles, so the mapped array should refresh at up to that rate, bounded by how fast the runtime can complete each serial transaction.
If the array still does not move after the task runs, the fault is on the wire or in the mapping — wrong slave address, framing mismatch, or the slave not answering — not in the program. Test each layer separately: confirm the task runs, then confirm a single small read completes, then extend the mapping.
Choosing between the configurator and Modb_l05.lib #
Commit with this rule: if your register map is fixed, the framing is fixed, and the number of slaves is small, use the configurator — you write no comm code and the runtime handles sequencing. If you must switch slave addresses at runtime, share one port between master and plain serial traffic, or you want the poll logic visible and version-controlled as code, use Modb_l05.lib. Do not mix them on the same port: one owner per serial interface, either the configurator or your blocks.
The same choice appears when you connect a SCADA client instead of a fieldbus slave: whether the PLC is master on serial or the data flows upward, the pattern of configuring the server side once and keeping poll logic in one place is the subject of the article on what you must configure on the PLC side for Modbus TCP, and it applies here at the serial port.
Getting the data onward #
Once the mapped variables update reliably, sending them to a cloud service is a separate engineering step. WAGO documents cloud communication for PFC100 and PFC200 controllers in application note 15719 (Microsoft Azure, Amazon AWS and IBM Bluemix are named targets) and publishes a matching cloud library numbered 16179. Before planning around that library, verify its version compatibility with your CODESYS 2.3 runtime and controller firmware; the thread behind this question stalled on exactly that linking step. Commission in order: serial read working, variables updating, then the cloud publish added on top, so a library or download error can never obscure a Modbus diagnostic.
One safety note: a Modbus master that stops receiving fresh values must not be the only thing standing between a process and an unsafe state. Treat communication loss as a fault with a defined plant response, not as a frozen display.
The decision #
- Fixed register map, one or two slaves: configurator under Modbus-Master[FIX], variables mapped as arrays via number of items.
- Dynamic addressing, per-port control, or code-first design: Modb_l05.lib function blocks, one instance per port.
- Any task configuration in the project: assign PLC_PRG to that task before you conclude anything about the Modbus mapping.
- Cloud publishing: application note 15719 and library 16179, verified against your runtime and firmware, added only after the serial path is proven.
Questions asked
Which Modbus serial master path should I pick in CODESYS 2.3?
Use the integrated configurator under Resources, PLC Configuration, Modbus-Master[FIX] when you want polling handled by the runtime and are comfortable mapping variables in the tree. Use Modb_l05.lib when you need polling logic in your own code, per-port control, or a pattern you can copy to a controller that lacks the configurator. Both read the same device; they differ in where the poll lives.
Why does my program not run after I add a task configuration?
The moment you add a task, the runtime executes only programs assigned to tasks, so an unassigned PLC_PRG stays idle. Add PLC_PRG to the task, download, and confirm the task's cycle counter or watchdog statistics show it executing.
How do I map several registers into one array instead of single variables?
In the configurator tree, right-click the mapped variable and choose number of items from the context menu; that turns the destination into an array of that length. With 20 holding registers mapped as an array of 20 words starting at device register 40001, the runtime writes the whole block in one read instead of 20 separate reads.
Is there a WAGO library for sending the Modbus data to the cloud?
WAGO publishes an application note numbered 15719 for PFC100 and PFC200 controllers talking to cloud services including Microsoft Azure, Amazon AWS and IBM Bluemix, plus a cloud library numbered 16179. Verify the library version against your CODESYS 2.3 runtime and firmware before planning around it; commission serial acquisition first so a cloud link error cannot hide Modbus diagnostics.
Does Modb_l05.lib work on firmware 22 of the PFC200?
The library ships with WAGO's CODESYS 2.3 toolset for the PFC series and is the documented serial master path for it, but you should confirm the installed library matches your runtime and firmware version before committing a project. If a download or link step reports unresolved externals, the library and runtime mismatch is the first thing to check.