[英]Energy meter data read and write to display in serial port using COM
我正在使用電表。 如何用Java讀取電表數據並編寫代碼?
這將是電力線節點發送和傳輸數據,它將轉換為RS232中的集中器以顯示在串行端口中。 Windows使用Java。
讀取儀表值的輸出示例是:
A 00 09 14 03 81 0C 03 10 03 00 30 B0 03 3A 00 :.........0°.:.
09 14 03 81 02 03 10 03 00 30 B1 2D 3A 00 09 14 ........0±-:...
03 81 02 03 10 03 00 04 B0 FA 3A 00 09 14 5C 81 .......°ú:...\
02 03 10 03 00 04 B0 FA
為了在Windows下讀寫數據到串行端口,我建議使用rxtx
http://rxtx.qbang.org/wiki/index.php/Main_Page
有一些讀寫示例:
http://rxtx.qbang.org/wiki/index.php/Using_RXTX
甲骨文提供了一個com api,但實際版本僅具有Solaris SPARC,Solaris x86和Linux x86的實現。
http://www.oracle.com/technetwork/java/index-jsp-141752.html
我為Windows使用了較舊的版本,但是很難找到並且存在一些缺點(例如,在沒有'help'的情況下找不到com4之上的端口,dll路徑中的空間有問題等等)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.