Unsolved Sending Hex data to a serial communication .Convert QByteArray to Hex
-
QByteArray monitorCommand ;
monitorCommand = "0204000C0006B038";
QByteArray data_to_transmit = QByteArray::fromHex(monitorCommand);
qDebug() << monitorCommand << data_to_transmit;
serialPort->write(data_to_transmit);qDebug output gives
"0204000C0006B038" "\x02\x04\x00\f\x00\x06\xB0""8"
but when converted as hex it should be \x02\x04\x00\0C\x00\x06\xB0\x38
this data should tobe sent it giveing wrong -
@mganesh said in Sending Hex data to a serial communication .Convert QByteArray to Hex:
but when converted as hex it should be \x02\x04\x00\0C\x00\x06\xB0\x38
It is. But qDebug() prints out text when the character is printable (and 0x38 is printable)
-
above program is giving error when we sent this data on serial port . its not replying anything.
may be hex value conversion wrong or may be \x00,\x00 that causing error?? -
@mganesh The above code snippet is for sure not the reason for your problem.