Jump to content

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


Recommended Posts

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!

ni_support.zip

Comunicação CLP.vi

Main_MB_2.vi

Link to comment

Both libraries use zero indexing, so you should be able to use the same value for starting register and number of registers in both libraries. The 4xxxx (or 4xx,xxx) is not important at the protocol level.

Its difficult verify whats going on because one function has a bunch of constants and the other is dynamic, but I'm assuming when your coworker tested it you've verified that:

  • They have the same IP address and port you have
  • They are using the same holding register start address and length
  • They are hitting the button to make sure it actually reads the holding register rather than skipping that code

If I'm understanding correctly, you ran the old code on your machine as well, and it failed? It sounds to me like the PLC has some sort of access control list, and your coworker added his machine to the list, but yours is not on it. This would make the most sense to me given that:

  • His machine works and yours doesn't with identical code and settings
  • The connection is being closed by the PLC
  • The closure appears to be immediate (note that the error occurs at the "write" function, which is the very first TCP function called after connecting. This would indicate that the connection is opened and then closed before you even enter the while loop).
Edited by smithd
  • Like 1
Link to comment

Talking with my coworkers, this PLC don't have an access control list. 

Code working if a use two PCs and modbus examples on LabVIEW as a modbus server. When  Ido this I can read with my code.

Cheking with Wireshark, with PLC, the communication was disconnected before transfer any modbus packet. When running with two PCs I could see modbus packets on wireshark.

My challage is how identify what cause this disconnection.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.