点击或拖拽改变大小

HslExtensionIniSerialByFormatString 方法

使用格式化的串口参数信息来初始化串口的参数,举例:9600-8-N-1,分别表示波特率,数据位,奇偶校验,停止位,当然也可以携带串口名称,例如:COM3-9600-8-N-1,linux环境也是支持的。
Use the formatted serial port parameter information to initialize the serial port parameters, for example: 9600-8-N-1, which means baud rate, data bit, parity, stop bit, of course, can also carry the serial port name, for example: COM3- 9600-8-N-1, linux environment is also supported.

命名空间:  HslCommunication
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:11.8.2.0 (11.8.2.0)
语法
public static void IniSerialByFormatString(
	this SerialPort serialPort,
	string format
)

参数

serialPort
类型:System.IO.PortsSerialPort
串口对象信息
format
类型:SystemString
格式化的参数内容,例如:9600-8-N-1

备注

在 Visual Basic 和 C# 中,这个方法可以当成为类型 SerialPort 的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考 扩展方法 (Visual Basic)扩展方法 (C# 编程指南) 获取更多信息。
备注
其中奇偶校验的字母可选,N:无校验,O:奇校验,E:偶校验,停止位可选 0, 1, 2, 1.5 四种选项
Among them, the letters of the parity check are optional, N: no check, O: odd check, E: even check, stop bit optional 0, 1, 2, 1.5 four options
参见