Modbus_RS485_LA
-
Modbus cant able to read and write above 40300
-
@Modbus_RS485_LA Is it a question?
-
we can't able to read and write 40300 above , how to solve the problem , so please any give the solution
-
Question 1) are you trying read or write holdings or coils ?
Question 2) did you try to read or write your holding registers or coils through index ? for example
if you want to read or write 40001 Holding registers then pass value 0 as index
if you want to read or write 40002 Holding registers then pass value 1 as index
Use Index of your registersAnd try to provide some information when you create thread of your problem.
-
1)yes, we are try to read and write for holding
example:
void modbusMaster::on_readButton_clicked()
{
if (!modbusDevice)
return;
statusBar()->clearMessage();
QModbusDataUnit readUnit(QModbusDataUnit::HoldingRegisters,300,10);
if (auto *reply = modbusDevice->sendReadRequest(readUnit, 1)) {
if (!reply->isFinished())
connect(reply, &QModbusReply::finished, this, &modbusMaster::readReady);
else
delete reply; // broadcast replies return immediately
} else {
statusBar()->showMessage(tr("Read error: ") + modbusDevice->errorString(), 5000);
}
}