SerialPort 中的属性
1 :PortName 通讯端口名称
2:BaudRate 波特率
3:DataBits 数据位
4:StopBits 停止位
5:ReadTimeout 超时时间
6:IsOpen() SerialPort对象是否打开
SerialPort 中使用到的(方法)函数
Open() 打开串行端口链接 Close() 关闭端口链接
发送数据:
1 / Write 该函数有三个重载
Write(string text) 向串行端口发送字符串
Write(byte[] buffer,int offset,int count) 使用缓冲区的数据,将字节写入到串行端口
Write(char[] chr,,int offset,int count) 将指定数量的字符写入到串行端口
接收数据:
1 / Read 函数
Read(byte[] buffer,int offset,int count) 读出缓冲区字节,写入到字节数组中
2 / 写入串行端口数据还有(WriteLine(string text),将指定字符串写入缓冲区)
3 / 读取串行端口数据还有(ReadByte(),读取一个字节)(ReadChar(),读取一个字符)
(ReadTo(string Value),读到指定字符串)(ReadLine(),一直读到输入缓冲区中的SerialPort.NewLine值)
SerialPort 中的事件
1:DataReceived 理解为接收串行端口数据的监听事件&