Detailed Description Use the static functions to generate a list of QSerialPortInfo objects. Each QSerialPortInfo object in the list represents a single serial port and can be queried for the port name, system location, description, and manufacturer. Terminal shows how to create a terminal for a simple serial interface by using Qt Serial Port. This example shows the main features of the QSerialPort class, like configuration, I/O implementation and so forth. Also, the class QSerialPortInfo is invoked to display information about the serial ports available in the system.

Active4 years, 2 months ago
Read

I'm trying to write read from a serial device using a usb / rs 232 cable.I'm pretty sure that my code writes ' #002s ' (this is a control code) to the serial device, because

a) the serial port is open

b) the serial port is writable

c) the code successfully navigates 'wait For Bytes Written (-1)'

d) when using a serial port sniffer the data is successfully written.

The issue I have is that I don't receive any data, and no data is being emitted from the other device. When using qt terminal writing the same ' #002s ' produces the correct response.

Any ideas?

Qt Serial Communication

many thanks.

Qt Serial Port Read Byte

Jon COJon CO

2 Answers

Qt Serial Port Programming

Qt Serial Port Read

Qt Serial Port Example

  1. If you want to write ' #002s ', Why not write at once? May be the serial device cant identify the control code when you write each character.

  2. Dvr drivers download free. And no need for this reading part .

    The Test_Serial::serialReceived will be called any way when you have the response from the serial device.

  3. And you can catch the error on opening the port by using the errorsignal from QSerialPort

techneaztechneaz

Qt Serial Port Read Char

The issue ended up being that the readyread flag is only emitted if theirs data to read. However I was sending the data too quickly for the external device to receive it. This meant that some data was lost thus the device never recognised it as a valid command.

This meant that it was still waiting for the message to finish, hence the 'IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_WAIT_ON_MASK) UP STATUS_CANCELLED COM1' error message upon closing the program. This also explains why their were no error messages with regards to writing data.

This also explains why the same program occasionally managed to read data, and at other times failed, (even without rebuilding the program, just re-running it.) When the data was read, the processor was more loaded, i.e. programs running in the background. This meant that the data was transmitted more slowly and thus the external device could recognise the commands and thus reply.

Jon COJon CO

Not the answer you're looking for? Browse other questions tagged c++qtserial-portwriting or ask your own question.

Coments are closed
Scroll to top