Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Limitation in QModbusTcpClient's data size

Limitation in QModbusTcpClient's data size

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 351 Views
  • 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.
  • P Offline
    P Offline
    peter li
    wrote on last edited by
    #1

    The story behind: Using a QModbusTcpClient I am trying to read the content from a device connected to a Modbus/TCP network. For that purpose I have written a Windows program (tested on 7 and 10) in Qt C++ (Qt version 5.7.0) which essentially calls QModbusClient::sendReadRequest with QModbusDataUnit::QModbusDataUnit(RegisterType type, int address, quint16 size) as a parameter, where type is HoldingRegisters, address equals to 1000 (could be another address, it is not important for this particular issue) and size is the length of the desired data to be read from the device.

    The issue: Everything works well when size is less or equal to 63 registers. Every attempt to go beyond this value results in an error, which depends on the device I am testing the program with, but generally says invalid request.

    Tests:

    I have tested this with several real devices and with a Modbus/TCP simulator obtaining the same results, i.e. size <= 63 -> okay; size > 63 -> error
    Modpoll from another side allows me to read a data chunk from the same devices and simulator with a size greater than 63 registers
    

    Some research: Here it is stated, that there is indeed a limitation, but it is 256 bytes, which equals to 128 16-bit registers, in other words - way above the limit of my read attempts.

    My suspicion: It appears that QModbusTcpClient does not allow reading more than a 63 registers.

    Question: Have anyone experienced such an issue using QModbusTcpClient and is there a way to overcome this limitation, apart from reading the data on two passes?

    J.HilkJ 1 Reply Last reply
    0
    • P peter li

      The story behind: Using a QModbusTcpClient I am trying to read the content from a device connected to a Modbus/TCP network. For that purpose I have written a Windows program (tested on 7 and 10) in Qt C++ (Qt version 5.7.0) which essentially calls QModbusClient::sendReadRequest with QModbusDataUnit::QModbusDataUnit(RegisterType type, int address, quint16 size) as a parameter, where type is HoldingRegisters, address equals to 1000 (could be another address, it is not important for this particular issue) and size is the length of the desired data to be read from the device.

      The issue: Everything works well when size is less or equal to 63 registers. Every attempt to go beyond this value results in an error, which depends on the device I am testing the program with, but generally says invalid request.

      Tests:

      I have tested this with several real devices and with a Modbus/TCP simulator obtaining the same results, i.e. size <= 63 -> okay; size > 63 -> error
      Modpoll from another side allows me to read a data chunk from the same devices and simulator with a size greater than 63 registers
      

      Some research: Here it is stated, that there is indeed a limitation, but it is 256 bytes, which equals to 128 16-bit registers, in other words - way above the limit of my read attempts.

      My suspicion: It appears that QModbusTcpClient does not allow reading more than a 63 registers.

      Question: Have anyone experienced such an issue using QModbusTcpClient and is there a way to overcome this limitation, apart from reading the data on two passes?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @peter-li Hi and welcome,

      I've ran into that issue as well. It's not always limited to the Qt Side, the ModbusMaster can also limit the max size of the requested registers.

      And no, besides splitting the request, I know of no other way to deal with the issue


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      P 1 Reply Last reply
      2
      • J.HilkJ J.Hilk

        @peter-li Hi and welcome,

        I've ran into that issue as well. It's not always limited to the Qt Side, the ModbusMaster can also limit the max size of the requested registers.

        And no, besides splitting the request, I know of no other way to deal with the issue

        P Offline
        P Offline
        peter li
        wrote on last edited by
        #3

        @j-hilk thanks for your reply, i will try that you said

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved