Hi Kuzulis,
I see your the expert in qserialdevice. I added a delay (depends on bytes sent and baud rate) to change the RTS signal. Seems to work.
I have another question I want to receive back a variable string of bytes. The first byte contains the amount (max is 255) is there a way to read one byte and then read x bytes depending on the first byte? In the code below I see the first byte with a msgsize of 15, but I don't see the 15 bytes of data. I know they are coming over because I can see them on the logic analzer. Do you know what is wrong?
Thanks
void TraceDialog:rocReadyRead()
{
while(m_port->bytesAvailable() < 1) {} //wait for datacount
char msgsize[1];
// Read the first byte to determine amount of bytes
qint64 datacnt = m_port->read(msgsize, 1);
char datamsg[32];
while(m_port->bytesAvailable() == 15) {} //wait for datacount
qint64 data2cnt = m_port->read(datamsg, 15);
//QByteArray data = m_port->readAlll();
//printTrace(data, true);
ui->lbError->setText(QString::number(m_port->error()));
}




rocReadyRead()
Reply With Quote
Bookmarks