字节收发
启用串口
首先在项目事件AfterOpenProject中打开需要使用的串口:
Ports.Add(
"COM2")发送字节
Dim Val() 
		As Byte 
		= New 
		Byte()
		{49,50,51,52}
		Ports("COM2").Write(Val,
		0,
		Val.Length)
接收字节
将DataReceived事件代码设置为:
Dim
cnt As Integer = e.Port.BytesToRead你也可以在任何地方使用下面的代码接收串口数据:
Dim cnt 
		As Integer 
		= Ports("COM2").BytesToRead
		If cnt 
		> 0 
		Then '缓冲区是否有数据
    Dim Val(cnt 
		- 1) 
		As Byte
    Ports("COM2").Read(val,0,cnt)
		End If