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
But when I change code for canonical mode of POSIX There are not thing display because program is waiting data from serial port
And when I dump serial port, it show me that there are something has received as below
Serialport (串口通信软件) 基于qt开发的串口通信软件. 测试数据 # 光照传感器: 有无光照 eecc00ff eecc00ff # 人体检测传感器: 是否有人 eecc00ff eecc00ff # 三轴加速度传感器 eecc00ff # 温湿度传感器. Thanks for your reply. I have been read your suggest post but the example in github use QSerialPort that is lib in Qt ( Qt is very easy to use like I did in Python). But I have limit only use C and I understand in C, it use POSIX for read serial port.
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
pi@raspberrypi:~/solarD/src $ ./solar.out
Send result [17]
Read result [0]
pi@raspberrypi:~/solarD/src $ ./solar.out
Send result [17]
Read result [2] 30 30
Send result [17]
Read result [0]
pi@raspberrypi:~/solarD/src $ ./solar.out
Send result [17]
Read result [2] 30 30
![Qt Serial Port Rs485 Qt Serial Port Rs485](/uploads/1/3/4/5/134512692/963559530.jpg)
Rs485 Cable
And when I dump serial port, it show me that there are something has received as below
pi@raspberrypi:~ $ tail -f /dev/ttyUSB0
00000001766100000000000000000000000000000000000000000000000000000000000000000000000000000002320000000000000000000000000000000000000000000000000000C000C000C0000000000011512080313555702000000000000000000000000000000000000000000000000000000000000!
=00000001766100000000000000000000000000000000000000000000000000000000000000000000000000000002324000000000000000000000000000000000000000000000000000C000C000C0000000000011512080313560302000000000000000000000000000000000000000000000000000000000000!
00000001766100000000000000000000000000000000000000000000000000000000000000000000000000000002320000000000000000000000000000000000000000000000000000C000C000C0000000000011512080313555702000000000000000000000000000000000000000000000000000000000000!
=00000001766100000000000000000000000000000000000000000000000000000000000000000000000000000002324000000000000000000000000000000000000000000000000000C000C000C0000000000011512080313560302000000000000000000000000000000000000000000000000000000000000!