QByteArray corrupts my data ???Why???
-
@
if (relays.open(QSerialPort::ReadWrite) {
// Set port settings here
QByteArray relay_arr("ch" + QByteArray::number(Ch_on) + "_onx");
relays.write(relay_arr);
}
@ -
Thanks Sierdzio.
I Will give your code a try tomorrow.Although I have found a semi sort of solution.
If I add a 1second delay after opening the ports and also a 1second delay before closing them, then it works.
This tells me that the <relays.waitForBytesWriten(-1)> does not work.
As far as I know this function is supposed to pause until all data has been written to the device. Can anybody maybe comment on this statement? -
- What is version of QtSerialPort?
- What is serial port type?
-
Hi kuzulis. Im not sure where to check the version number for QtSerialPort.
The Serial port is a RS232 device.Sierdzio. I implemented your above mentioned code.
No difference. The only thing I fount to work is if I add a 1sec delay after opening and before closing the port. -
2 achmed
bq.
Im not sure where to check the version number for QtSerialPort.From where you took the QtSerialPort?
bq. The Serial port is a RS232 device.
This is USB/Serial converter, on-board device or something else? What chip?
bq. The code bellow also displays corrupted data.
What do you see when do writing of relays.write("all_offx") ?
-
bq. They are all giving the same problem.
What is a problem? I repeat a question again: what do you see when do writing of relays.write(“all_offx”) on other side?
bq. Not sure where they got it from.
It is in your interests to know it. Without it further reasonings are senseless.
-
[quote author="kuzulis" date="1415359623"]What is a problem? I repeat a question again: what do you see when do writing of relays.write(“all_offx”) on other side?
[/quote]As Mentioned in the first post. The output data is corrupted.
Example: ^%$%^&*(
In Other words unreadable. -
This can not be in principle. Can you check same, but without closing of device?