的串口通訊支持總是讓人覺得有所不足
這裡講述的串口通訊類使用native代碼
在說明如何使用這個類前
1
創建一個CRs
例
Dim moRS
With moRs
End With
moRS
moRS
moRS
為了處理異常情況
2
本類為Rx和Tx准備了兩個緩沖區(buffer)
例如
moRS
moRS
先調用Rx方法(參數為您需要從串口讀取的字節數)
例如
moRS
Dim sRead as String=moRs
需要注意的是
如果你沒有指明需要讀取的字節數
版本信息
Project History
Rev
Rev
Added Async support
Rev
Minor bugs fixed
Rev
Fixed BuildCommmDCB problem
Rev
Fixed problem with ASCII Encoding truncating
Rev
Added IDisposable / Finalize implementation
Rev
Fixed problem on DCB fields Initialization
Rev
Added XON/XOFF support
Rev
Added support to COM port number greater than
Rev
Added CommEvent to detect incoming chars/events(!)
Updated both Tx/Rx method from Non
Removed unused Async methods and other stuff
Rev
Fixed incorrect character handling when using EnableEvents()
Rev
Fixed some bugs reported by users
Rev
Removed AutoReset of internal buffers and added PurgeBuffer() method
Rev
Update internal stuff now using Win
Rev
Added IsPortAvailable() function (thanks to Tom Lafleur for the hint)
Revised some API declaration
Fixed some problems with Win
Rev
Fixed bug introduced on rev
Rev
Added SetBreak/ClearBreak methods for sending break signal over the line
Rev
Fixed incorrect field on COMMCONFIG Structure
Rev
Fixed bug causing troubles accessing already in use ports (folks
Rev
Fixed bug on DTR property (thanks to Charles
Rev
CommEvent is no more raised on a secondary thread (please note that this is valid only if event handler is not associated with a static method)
pEventsWatcher now uses a background thread
Rev
Fixed EscapeCommFunction declaration
Fixed incorrect Pariti enum entry
Rev
Fixed memory leak causing random program termination without any message
Thanks to Ralf Gedrat for testing this scenario
Rev
Fixed bug DisableEvents not working bug (Thanks to Jean Bédard)
From:http://tw.wingwit.com/Article/program/net/201311/11852.html