• Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Multiple Modbus Read Registers Access by an Array of Elements

    Scheduled Pinned Locked Moved CODESYS
    2 Posts 2 Posters 2.5k Views
    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.
    • M
      mikeardy
      last edited by mikeardy

      (I posted this on CODESYS Forum without any suggestions or help)...

      Hi,
      I need to read about 250 UDINT via Modbus in Slave mode. A SCADA manages this data and write via Modbus remotely to my controller.
      So inizially I configured on my controller a modbus slave device. Due to Modbus limitations I configured 4 channel in Read Holding Registers mode with an array of 125 elements (500 elements in total of WORD type).
      In a GVL I defined an array of 250 elements of UDINT type poiting at the starting address of the input registers, beginning at %IW60.
      Finally in my application program I used the array poiting values I need directly by index.
      Is it the right way or maybe there is a quite simpler or "more readable" and canonical method?
      See pictures I added to this post.
      Many thanks!

      0_1523962519242_CODESYS_ModbusSlave_1.PNG

      0_1523962402773_CODESYS_ModbusSlave_2.PNG

      0_1523962406362_CODESYS_ModbusSlave_3.PNG

      D 1 Reply Last reply
      Reply Quote 0
      • D
        DavidCozens @mikeardy
        last edited by

        @mikeardy
        Consider this as an alternative. I've created 500 holding registers
        0_1524082533025_img1.png
        In my program (it could be ina GVL) I have created an addary of 250 UDINT.
        0_1524082629032_img2.png
        Then I was able to map all of the registers in one go
        0_1524082699632_img3.png

        For generic CODESYS questions I suggest trying https://forum.codesys.com/, for many generic CODESYS questions there will already be an answer posted.

        1 Reply Last reply
        Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post