S
S
Slavka2016-01-20 14:35:32
Qt
Slavka, 2016-01-20 14:35:32

ModBus master, GUI code?

How to organize the algorithm for the master (ModBus ASCii)? for example, I form a request ":....." and send it to the slave device, how can I wait for a response then? using QtSerialPort

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lamazavr, 2016-01-20
@Slavka_online

You need to read response with timeout.
Something like:

serial->write(msg, len);
if (serial->waitForReadyRead(timeout_ms))
{
    serial->read(buffer, 1);
    ....
} else //timeout error

why are you writing? there is also libmodbus

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question