hi guys,
i am writing a program to talk to an external device through serial port. this device is controlled by a string, and the string should be ended by a carriage return (CR).
here is part of my program:
Qt Code:
txStr = "#SEND"; serialPort->write(txStr, 5); serRec = serReceive2();To copy to clipboard, switch view to plain text mode
after i finished my program, and tried to talk to the device, there was no response. then, i connected my pc to anther pc, and displayed the string, which i sent to that device, in hyper terminal. i found the string which i sent was correct, but just no carriage return. it looks like my carriage return character has been eaten somehow.
i tried to add "\n", "QChar(13)", "QChar(10)", none of them are working.
anyone can give me a hint, please?
thanks inadvance.
Edit:
problem solved. i made a stupid mistake.
i want to send a 6 characters string, but i told sending function that only sent 5 characters.
Bookmarks