[Qt-creator] Qextserialport - checking that data has been sent for RS485 comms

Robert Wood robert.wood at apostrophe.co.uk
Mon Jan 11 20:51:01 CET 2010


Folks,

Not sure this is quite the right place for this question, but here goes:

I am writing data out to a VCP using qextserialport and all works fine 
in terms of getting the data to and fro the PC. One thing I do want to 
do though, is check when the last byte of data has actually been sent. 
ie The output buffer of the UART IC itself is empty.

Reason I want to do this is that once all the data has gone, I need to 
immediately set the RTS line low, so my little RS485 adapter is put into 
receive mode.

I thought that maybe waitForBytesWritten(int msec) would do the trick 
(and maybe it does), but I can't get it to work.

I've tried

vcp->writeData(&c[0],10);
while (vcp->waitForBytesWritten(x) == false);
vcp->setRts(false);

where x is various values, including -1, but it just jumps out and the 
RTS line gets set low too early, the data thus not getting sent out.

Anyone know whether what I want to do is possible?!

Many thanks,

Rob



More information about the Qt-creator-old mailing list