星期四, 4月 03, 2008

java, C# 與serial port通訊

需下載java commapi
由於會讀取javax.comm.properties
而此檔因OS不同所以commapi有不同OS版本
不要載錯

主要有三個配置檔
存放路徑
此是安裝JRE的軟體
1.C:\Program Files\Java\j2re1.4.2\bin\win32com.dll
2.C:\Program Files\Java\j2re1.4.2\lib\javax.comm.properties
3.C:\Program Files\Java\j2re1.4.2\lib\ext\comm.jar

Or
此是安裝J2sdk的軟體
1. C:\j2sdk1.4.1_01\jre\bin\win32com.dll
2. C:\j2sdk1.4.1_01\jre\lib\javax.comm.properties
3. C:\j2sdk1.4.1_01\jre\lib\ext\comm.jar

關於javax.comm.properties 的位置
ㄟ..好像是跟程式碼放一起哩...

If you instead got the message “no ports found”, there are a couple of possibilities:

* There actually aren't any serial ports available on your system—either the low-level comm port drivers are not installed right, or other programs have them open.
* The javax.comm drivers are not installed properly.


reference

JAVA Communication API(RS232/485)
JAVA RS232實作
java comm安裝
Installing & Configuring Java for HC11 Code Download

===============================================
c#讀rs232
SerialPort (RS-232 Serial COM Port) in C# .NET

沒有留言: