Modbus Client Example
Hi,
I was testing modbus server example from the library and it works well, I can connect to it from a Modbus client simulator, read and writes, everything's ok. But now, when I try to test the client example, I launch my modbus server simulator but I can't connect to it from PLC client but nothing happens. I am wondering if it is neccesary to force any variable to connect to the server. I tried to force xStart but same result.
What could be the problem?
Regards,
I was testing modbus server example from the library and it works well, I can connect to it from a Modbus client simulator, read and writes, everything's ok. But now, when I try to test the client example, I launch my modbus server simulator but I can't connect to it from PLC client but nothing happens. I am wondering if it is neccesary to force any variable to connect to the server. I tried to force xStart but same result.
What could be the problem?
Regards,
Comments
I need detailed information to analyze this problem. Please send me the answers to the following questions:
Are you using the tool "Modbus TCP Server" from https://modbus.org/ for testing of Modbus TCP client example?
Are the Modus TCP Server and Modbus TCP Client in the same network subnet?
Could you send the screenshot or the description of the FB "MB_TCP_Client" parameterization in debug mode and the settings of the TCP server simulator, please?
Thanks & Best Regards
Eduard
Thanks for your quick response.
Answer your questions below:
"Are you using the tool "Modbus TCP Server" from https://modbus.org/ for testing of Modbus TCP client example?"
No, I am not using that Modbus TCP server. How can I get this tool? I can't see download section. I am using "ModRsim2" Yes. The PLC is not connect to the PC through ethernet cable but PLC is connected to the same subnet network than the PC. In fact, I am working remotly without problems. Yes, attached you can find the screenshots. Modbus Server doesn't have any configuration possible, just your localhost IP and port.
I can see, taht you have not set xStart = True, in this example application. If your application is running, the iState should change the state (number). Currently iState=0, it means that the parametrization is not executed (the settings will be set in Step: iState=10). Please verify your start conditions.
The https://modbus.org/ is the Modbus Organisation and is responsible for Modbus specificatiion and standard (https://modbus.org/about_us.php). The organisation developed the "Modbus TCP Toolkit". It provides all the necessary pieces to develop a Modbus TCP/IP-compliant device, including documentation, diagnostic tools, sample source code, and pre-test software to prepare for Modbus conformance certification.
You can bay this tool from modbus organisation or you can also use the "Modbus Poll" Tool (listed in https://modbus.org/tech.php). Modbus Poll is a Modbus master simulator designed primarily to help developers of Modbus slave devices or others that want to test and simulate the Modbus protocol.
I assume that the "ModRssim2" tool can also simulate the Modbus server functionality, but it is difficult for us to support every third partry tool.
Best Regards
Eduard
Thank you for the response. If I change the value of xStart, the iState value changes to 100 and never moves from there... Modbus poll is just for Modbus master simulator but I need a modbus slave simulator, because of I am using ModRssim2.
Anyways, using ModRssim2 and ModBus client simulator I can communication between them, so the problem must be at the client of PLC.
Best regards,
please send me informations about:
- The used PLC
- FW Version
- PLCnext Enginner Version
- Used Version of Modbus TCP Library.
If possible, please send me your contact data, maybe we can start a remote session to analyze this issue.
E-Mail: emuenz@phoenixcontact.com
Thanks & Best Regards
Eduard
thanks for providing the following system information via e-mail:
- PLC AXC F2152
- FW version 2021.0.3 LTS
- PLC Next Engineer 2021.3
- Modbus TCP version: I am not sure, the example says: MB_TCP_9_EXA_TCP_Client.pcwex
I assume, it can be the same bahavoir as in following post: https://www.plcnext-community.net/en/?option=com_easydiscuss&view=post&id=8358
The Modbus TCP library has only been released up to PLCnext Engineer version 2021.0.x.
The next version - which will be compatible with PLCnext Engineer 2021.3 - is currently in development.
I have sent your request to the responsible team for review.
I would like to recommend you to install the PLCnext Engineer Version 2021.0.x and restart the test.
Thanks & Best Regards
Eduard
I've already sent you an email with the information,
Thank you.
Best Regards.
Thank you. I will try with the other version of software. Anyways, it is strange, because the other way around (modbus server on PLC and modbus client on simulator) works perfectly with this version.
Best regards,