# Modbus RTU/TCP communication check in CodeSys

**URL:** <https://www.wago.community/t/modbus-rtu-tcp-communication-check-in-codesys/2738>\
**Category:** CODESYS\
**Created:** [May 28, 2026, 10:02am UTC](https://www.wago.community/t/modbus-rtu-tcp-communication-check-in-codesys/2738 "2026-05-28T10:02:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tomast](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@Tomast](https://www.wago.community/u/Tomast)\
**Post date:** [May 28, 2026, 10:02am UTC](https://www.wago.community/t/modbus-rtu-tcp-communication-check-in-codesys/2738/1 "2026-05-28T10:02:56Z")

</div>

Hi everyone,

As I am busy with projects that contain many modbus RTU remote IO’s i was wondering if someone knows the best practices to do the modbus communication check in PLC program. I would like to implement a fallback to the devices if modbus fault occurs and there is no communication with with one of nodes? i would apprecieate if someone can give me some advice.

---

<div class="post-metadata">

**Author:** ![MatthewKim](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@MatthewKim](https://www.wago.community/u/MatthewKim)\
**Post date:** [May 29, 2026, 5:34am UTC](https://www.wago.community/t/modbus-rtu-tcp-communication-check-in-codesys/2738/2 "2026-05-29T05:34:54Z")

</div>

![image](https://us1.discourse-cdn.com/flex016/uploads/wago/original/2X/c/c27382618c5bbd99c86ff7833718d8be9a6d240f.png)

I thought about whether it might be possible to check via xError, but I haven’t tested it directly myself.

---

<div class="post-metadata">

**Author:** ![bjornidar](https://avatars.discourse-cdn.com/v4/letter/b/5fc32e/32.png) [@bjornidar](https://www.wago.community/u/bjornidar)\
**Post date:** [May 29, 2026, 10:29am UTC](https://www.wago.community/t/modbus-rtu-tcp-communication-check-in-codesys/2738/3 "2026-05-29T10:29:08Z")

</div>

On RTU I would check if xError is TRUE after xTrigger is reset by the function block.

For TCP you can use ComState if you are using the configurator.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/wago/original/2X/2/2174a2d61c684a33b41825d9a75068433b82cbe0.png)

---

<div class="post-metadata">

**Author:** ![AlfonsoAmigo](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@AlfonsoAmigo](https://www.wago.community/u/AlfonsoAmigo)\
**Post date:** [June 2, 2026, 12:16pm UTC](https://www.wago.community/t/modbus-rtu-tcp-communication-check-in-codesys/2738/4 "2026-06-02T12:16:10Z")

</div>

Hello

As somebody has mention before, the way to monitor if a slave is alive or not is via the properties of the instance created with the Modbus configurator.

Any slave you declare is a instance of type “ModbusSlaveComPort”

 ![image](https://us1.discourse-cdn.com/flex016/uploads/wago/original/2X/d/dc9b478b25147b539ea897785a8504fc2223a039.png)

you can fin the declaration at library “IoDrvModbus” and its interface is as shown

 ![image](https://us1.discourse-cdn.com/flex016/uploads/wago/original/2X/e/e24fc3fdb5ce4d17db8e7603cc948f73fc66f2da.png)

Output variable “xError” will become TRUE when communication fails. if you left “Auto-restart communication” check box unchecked, in the Mosbus Master (client)

 ![image](https://us1.discourse-cdn.com/flex016/uploads/wago/original/2X/8/8c3b6c566fa2373989784fd2c635389bd0ec84b1.png)

then you can get the slave back at the poling loop by programming issuing a rise edge at “xAcknowledge” input variable of the corresponding Slave (Server), doing it in ST language may be as simple as following

 ![image](https://us1.discourse-cdn.com/flex016/uploads/wago/original/2X/2/2e746533b5d9faeb1a4d224ed3e6d085a7d5cf41.png)

We used this trick in a project where we may have variable number of slaves and we just want to run time just get into the pooling cycle just some of then.

Best regards.

---

<div class="post-metadata">

**Author:** ![Tomast](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@Tomast](https://www.wago.community/u/Tomast)\
**Post date:** [June 11, 2026, 11:15am UTC](https://www.wago.community/t/modbus-rtu-tcp-communication-check-in-codesys/2738/5 "2026-06-11T11:15:32Z")

</div>

Hi Guys, thank you for all your responce. Now i get the idea how can i get it done.
