04-05-2018 02:10 PM
LabVIEW 2016
Modbus Communication with a PLC Siemens SIMATIC ET 200SP
Windows 7 Ultimate
Hi,
When I run my code it return error 66 at Read Holding Registers function. I ran this code as a VI on the development virtual machine and as a *.exe on real machine, but received the same error.
Try in another computer and receive the same error.
As PLC code was developer by other programmer I ask him if this communication was working on his machine, he showed me a LAbVIEW code running with Modbus communication with the same PLC. He was using a LabVIEW 2013 with old Modbus Library, but I had taken his code and ran on my PC with LV 2016 and receive the same error on MB Ethernet MAster Query Read Holding Registers(Poly).vi. Also generate an exe file and run on my real machine and still receiving error 66.
In all scenarios I can ping PLC and receive answers, but cannot read or write any data with LabVIEW.
First picture is my code with LV 2016 VIs.
Second picture is error message.
Third one is the other programmer code with old Modbus Library.
On the first code, if I remove Read Holding Registers VI and connct wires directly or put a property node to set any property it runs without errors. If change this function for any other modbus function return error 66.
Any idea what I am doing wrong?
Thanks in advance!
Solved! Go to Solution.
04-10-2018 09:32 AM
Hi Abel,
TCP/IP communication errors most oftem are caused by timeout conditions in either the LabVIEW TCP/IP VIs or at the operating system level. Specifically, the Error 66 occurs when the TCP/IP connection is closed by the peer. It means that Windows notices that the data is not returned in the timeout limits, and it closes the TCP/IP connection. When LabVIEW trys to communicate after the connection is closed, Error 66 appears.
You can try to increase the length of the timeout value. Also, make sure that the cable is properly connected to PLC and the PLC parameters are in the correct settings for slave communication with your program.
If it dosn't work, try run your code to communicate your machine as master to another computer, as slave, using another fixed IP. This test may answer if the source of the issue is the LabVIEW code or the configuration and connection with the PLC. Feel free to share with us your results or any progress you had!
See more in:
https://forums.ni.com/t5/LabVIEW/modbus-TCP-comm-error-with-fixed-IP-address/td-p/1008392
04-10-2018 09:52 AM - edited 04-10-2018 09:58 AM
Hi Isabelle,
I ran this code communicating with other PC running as modbus slave and my code is working.
I used wireshark to checked communication and with PLC communication was lost immediately, before change any modbus message. I tryed increase timeout, but had same behavior.
On lavag.org forum a guy told me that some PLCs have access authorization settings, but is not the case for PLC I am using.
Thanks.
04-12-2018 08:38 AM
04-12-2018 02:24 PM
Hello Abel!
Glad to know that you have managed to resolve the communication between them!
Also, thanks for the answer.
06-19-2024 12:54 AM
Hi Abella,
Thanks for the post, I'm facing issue with same error while communicating with a MASIBUS AO module from my PC but I'm not able to resolve this particular issue as there is no option to enter the PC IP into the MASIBUS controller configuration settings.
And also when I try to set voltage through a seperate test vi made using labview modbus functions I'm able to write voltage into holding registers but when same functions are used in my main application and I try to configure ,I'm getting error 66.