LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 66 on Modbus Master.lvclass:Read Holding Registers.vi

Solved!
Go to solution

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.

 

Modbus Master_new subVIs.pngerror message.PNGModbus Master_old library.png

 

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!

Abel Souza
Engenheiro Eletrônico
LabVIEW User since 8.5
Download All
0 Kudos
Message 1 of 6
(6,872 Views)

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:

Modbus TCP comm error with fixed IP address - Fórum

https://forums.ni.com/t5/LabVIEW/modbus-TCP-comm-error-with-fixed-IP-address/td-p/1008392

Isabelle Orlandi
Engenharia de Aplicações
National Instruments Brasil
Message 2 of 6
(6,812 Views)

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.

Abel Souza
Engenheiro Eletrônico
LabVIEW User since 8.5
0 Kudos
Message 3 of 6
(6,807 Views)
Solution
Accepted by Abel_Souza

Hi Isabelle,

 

My coworkers told me that this PLC did not have access authorization, but we need input PC IP on PLC to communicate, so it have access  authorization setting.

Now using IP setting configured on PLC its working well.

 

Thanks!

Abel Souza
Engenheiro Eletrônico
LabVIEW User since 8.5
0 Kudos
Message 4 of 6
(6,784 Views)

Hello Abel! 
Glad to know that you have managed to resolve the communication between them!  
Also, thanks for the answer. 

Isabelle Orlandi
Engenharia de Aplicações
National Instruments Brasil
0 Kudos
Message 5 of 6
(6,760 Views)

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.

0 Kudos
Message 6 of 6
(698 Views)