Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-62192

MODBUS custom command doesn't work

    XMLWordPrintable

Details

    • 2c0bb738e988d84f36169e0103d051745b678479 (qt/qtserialbus/dev) 17ac276e9b4fcde0f2e2b9a68a01ef6cdde31cf5 (qt/tqtc-qtserialbus/tqtc/lts-5.15)

    Description

       I'm trying to send custom MODBUS request but each time I get an empty data in reply, although I see the correct result in the logs (ADU, PDU).

          auto cmd = QModbusPdu::FunctionCode(0x42);
          auto request = QModbusRequest(cmd, QByteArray::fromHex("00080f"));
          QModbusRequest::registerDataSizeCalculator(
                      cmd,
                      [](const QModbusRequest &)->int {
              return 19;
          });
          /*
             request.registerDataSizeCalculator(
                      cmd,
                      [](const QModbusRequest &)->int {
              return 19;
          });
          */
      
      ... send rawRequest ...
      
      qDebug() << "data"
               << reply->rawResult().data()
               << "code"
               << reply->rawResult().functionCode();
      
      // data "" code 0
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            heimrich Karsten Heimrich
            uralbash Dmitry S
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes