Qt Serial Port Rs485
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. Note: The serial port is always opened with exclusive access (that is, no other process or thread can access an already opened serial port). Use the close method to close the port and cancel the I/O operations. Having successfully opened, QSerialPort tries to determine the current configuration of the port and initializes itself.
The example above shows how to open all available serial ports and then close them. But I want to open a given serial port, such as COM6, set its BaudRate,DataBits,Parity,StopBits ,FlowControl and then send a string of hexadecimal numbers.
1 Answer
This video will definitely help you: https://www.youtube.com/watch?v=UD78xyKbrfk
You can also find similar code here: https://cboard.cprogramming.com/cplusplus-programming/169624-read-write-serial-port.html
Example code:
Qt Serial Port Rs485
Not the answer you're looking for? Browse other questions tagged qtserial-portqt5 or ask your own question.
I've successfully read data from EKM metering by using Python as in http://forum.ekmmetering.com/viewtopic.php?f=4&t=3472 link.But before that I've tried to use C++ for a long time but it is unsuccessful. I follow this document http://www.chemie.fu-berlin.de/chemnet/ ... tml#SEC237, the below is my codeThe result is
Send result [17]
Read result [0]
pi@raspberrypi:~/solarD/src $ ./solar.out
Send result [17]
Read result [2] 30 30
And when I dump serial port, it show me that there are something has received as below
00000001766100000000000000000000000000000000000000000000000000000000000000000000000000000002320000000000000000000000000000000000000000000000000000C000C000C0000000000011512080313555702000000000000000000000000000000000000000000000000000000000000!
=00000001766100000000000000000000000000000000000000000000000000000000000000000000000000000002324000000000000000000000000000000000000000000000000000C000C000C0000000000011512080313560302000000000000000000000000000000000000000000000000000000000000!
Anyone can suggest me how can I fix it.