hello every one.. i have a small problem here. I am communicating with a hardware on rs232 serial terminal.. I am able to send a start of frame and receive back a acknowledge-ment from the hardware device. i am sending a fixed string i.e 0xAC,0xCA,0x1F as the start of the frame which the hardware device sud check for and give a ackn. which is working fine . this is what i am doing i am writing the string AC CA 1F to the port this is done successfully.i get a acknowledgment from the hardware also.
static const char mydata[] = { 0xAC,0xCA,0x1F};
char i = port->write(mydata,sizeof(mydata));
static const char mydata[] = { 0xAC,0xCA,0x1F};
QByteArray data = QByteArray::fromRawData(mydata, sizeof(mydata));
char i = port->write(mydata,sizeof(mydata));
To copy to clipboard, switch view to plain text mode
Now the problem is when i try to send some configured hexa format data which i have
in QByteArray hexadecimaldata; i am splitting the each byte in it and putting them into firstByte and secondByte. cause i have to send the configured data byte by byte and the data is never more then 2 bytes.
firstByte = "0x"+hexadecimaldata.left(2);
secondByte = "0x"+hexadecimaldata.mid(1, 2);
char i = port->write(firstByte);
char i = port->write(secondByte);
firstByte = "0x"+hexadecimaldata.left(2);
secondByte = "0x"+hexadecimaldata.mid(1, 2);
char i = port->write(firstByte);
char i = port->write(secondByte);
To copy to clipboard, switch view to plain text mode
the configured hexadecimaldata is not wrting to the port..
Pls tell me if i am going wrong some wer. ?
thank you
Bookmarks