M172 programmatically read/write Modbus TCP via Ethernet Port
APC UPS Data Center & Enterprise Solutions Forum
Schneider, APC support forum to share knowledge about installation and configuration for Data Center and Business Power UPSs, Accessories, Software, Services.
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send InviteCancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2025-04-0401:05 PM
M172 programmatically read/write Modbus TCP via Ethernet Port
Hi,
I'm very new to the M172 and EcoStruxure Machine Expert HVAC, and I'm primarily using Structured Text to program the M172 PLC.
I’ve configured the M172 as a Modbus TCP Master and added slave devices under the Ethernet Configuration. I understand that I can assign Modbus functions and status variables directly through the configuration, but I’m exploring whether I can handle Modbus communications programmatically instead—so I can catch and process return values from each read/write operation.
I used the sysMbS_AcceptClient function to accept connections from Modbus clients based on their IP addresses. It returned 0, which suggests the parameters were loaded correctly. However, when I use sysMbMTCP_FC03 and sysMbMTCP_FC06 in a background task to read/write to the same Modbus client, I consistently receive error code 14 (Invalid response message).
Interestingly, when I configure and access the same client manually via the Ethernet Configuration tab, read/write operations work as expected.
Unfortunately, I haven’t been able to find clear documentation or Structured Text examples for using sysMbS_AcceptClient, sysMbMTCP_FC03, and similar target functions to help with further debugging.
Any guidance or examples on the correct usage of these functions for programmatic Modbus communication with the M172 would be greatly appreciated.