REXYGEN Community Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Login

    Raspberry Pi and Click PLC, Modbus TCP

    Modbus TCP
    3
    6
    2.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      contactform
      last edited by

      Good day,
      I have been using the trial version of Rexygen with a Raspberry Pi 3B+. I use Studio on a Win10 machine.
      I have successfully tried several examples with inputs/Outputs on the RPi.
      I have run into a problem in getting the RPi to talk to a remote plc over Modbus TCP. The plc is an Automation Direct Click.
      I designed the project on the Studio and downloaded to the RPi. Initially, I was reading two registers on the plc without a problem using the Watch.
      Then, I went into Studio, and added two more registers to read. I downloaded to RPi and Watched. The original two registers read properly, but the two new ones show “0” on red banner.
      If I go to Configure and change the register addresses, the original two tags will read correctly, but the other two show the red error banner.
      Is there a limitation on the number of registers to read? I have attached screen captures in the hopes you can give me some other things to check.

      0_1553248024098_rexyCapture.PNG
      0_1553248043404_rexy2Capture.PNG

      Thank you!
      Tom

      1 Reply Last reply Reply Quote 0
      • jaroslav_sobotaJ
        jaroslav_sobota
        last edited by jaroslav_sobota

        Hi Tom,
        thanks for the detailed analysis and screenshots.

        There is no limitation on the number of registers to read. At least not on the side of REXYGEN.

        Which registers are the OK ones? 21 and 22? Did you try reading only the new ones? Is it still not working?

        Can you please share both your REXYGEN and CLICK projects with me? I have the CLICK PLC here so I'll be able to test everything.

        Also please enable I/O driver messages in the System log and send me the System log. Thank you.

        Jaroslav

        1 Reply Last reply Reply Quote 0
        • C
          contactform
          last edited by jaroslav_sobota

          Hi again,
          I’ve attached the System log and the REXYGEN project as you requested.

          I did some additional checking and now believe it is a communication timeout issue. I tried playing with the modbus timeout numbers without much success.

          However, it is now clear that the system will always read the first two registers in the Configure list. Sometimes it will read the first 3, never all 4.

          The log file confirms the time out issue. You can see where DS23 was timing out, then I stopped and changed the register order, then DS23 was OK and DS22 was timing out.

          I’ve included the CLICK project. It is only a few rungs long and is a bench test of this modbus communication system.

          Regards,
          Tom

          1 Reply Last reply Reply Quote 0
          • jaroslav_sobotaJ
            jaroslav_sobota
            last edited by

            Hi Tom,
            thanks for your projects. The problem is that the Click PLC is not able to process multiple Modbus commands at once. There are 2 possible approaches to overcome this limitation:

            • Limit the maximum number of Modbus commands to 1 in REXYGEN. Yes, I have observed communication problems even when only 2 Modbus packets were sent at once.
              0_1553262110771_modbus_max_requests.png

            • But it's even better to really squeeze all the data into one Modbus command and read all the 4 registers at once.
              0_1553262260842_modbus_read_multiple.png
              In your task, you'll then use the INQUAD function block to process the incoming data. You'll rename the block to MTM__readDS.
              0_1553262331682_modbus_INQUAD.png
              In this case you'll need to put all the registers in a row in the CLICK PLC, but I believe you can easily achieve it.

            Hope this helps, let me know.

            Jaroslav

            1 Reply Last reply Reply Quote 0
            • S
              sisktom2
              last edited by sisktom2

              Thanks, Jarslav

              I knew it had to be a timing issue! Just not familiar enough with the system yet to know what to adjust. Will keep the forum updated.

              Tom Sisk

              1 Reply Last reply Reply Quote 0
              • S
                sisktom2
                last edited by

                Hello folks,

                I just wanted to confirm that reducing the "Max. requests" number to 1 allows multiple Modbus reads of the Click PLC.
                I agree that reading registers in groups of 4 or 8 is more elegant and will try that next.

                Cheers,
                Tom Sisk

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post

                This is a community forum for REXYGEN users and fans. Detailed information can be found at REXYGEN homepage.

                There is also an outdated REXYGEN community forum.

                Powered by NodeBB.