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




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!


Comunicação CLP.vi


Link to post

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 post

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 post

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.



  • Like 1
Link to post

Join the conversation

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

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.

  • Similar Content

    • By drjdpowell
      I am just starting on trying to be able to use Python code from a LabVIEW application (mostly for some image analysis stuff).  This is for a large project where some programmers are more comfortable developing in Python than LabVIEW.  I have not done any Python before, and their seem to be a bewildering array of options; many IDE's, Libraries, and Python-LabVIEW connectors.  
      So I was wondering if people who have been using Python with LabVIEW can give their experiences and describe what set of technologies they use.
    • By Yaw Mensah
      I have installed Labview 2020 on Dedian Buster using the rpm to deb conversion method via alien. Due to Architecture mismatch i deleted the *i386.rpm files before conversion.
      My Problem is that after creating a project at "Build Specification"-> "rigth click" i am only able to select "Source Distribution". Application does not show up as an option. 
      I will be grateful for any suggestions.
      Thank you in advance.
    • By javier_r
      VIPM.io now allows you to post LabVIEW Resources, Ideas, and Tools. For example, you could post a link to a video tutorial or blog article about a package. You can also post ideas, like feature requests or new tools. Best of all, package developers are notified when you post your ideas and resources, and you can comment and discuss posts with the community. Take a look at this video to learn more: https://www.vipm.io/posts/664960df-f111-4e13-989a-24be8207182d/

    • By Shuvankar Das
      I want to connect My ccd camera with labview. The details of my system is given bellow. I cannot connect it please help   OS:  WINDOWS 7, 64bit   LabView Run-Time 2013(64-bit) NI-IMAQ 4.8 NI-IMAQdx 4.3   Camera: QICAM Monochrome Cooled (QIC-F-M-12-C) Model QICAM Resolution 1392 x 1040 Sensor 1/2" Sony ICX205 progressive-scan interline CCD Pixel Size 4.65 x 4.65µm Cooling Type Peltier thermoelectric cooling to 25˚C below ambient Digital Output 12 bit Video Output FireWire (IEEE 1394b) Max. Frame Rate 10 fps full resolution @ 12 bits Pixel Scan 20, 10, 5, 2.5MHz Mount Type C-mount optical format  
    • By javier_r
      Hello everybody!
      Wondering how many people have tried the new vipm.io site. We have added a ton of features to make it easy to Discover LabVIEW Tools and there are some cool ones coming soon.
      Check it out and let me know what you think 😀

  • Create New...

Important Information

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