serialport测试实现串口打开关闭及设置所有常用属性
串口链接,通过VS测试 public partial class Form1 : Form { public Form1() { InitializeComponent(); SerialNameSelect(); SelectPortStopBits(); SelectHandShake(); SelectParity(); SerialNumber.SelectedIndex = 0; serialBit.SelectedIndex = 2; SerialDataBits.SelectedIndex = 3; SerialStopBits.SelectedIndex = 1; SerialHandShoke.SelectedIndex = 1; SerialParity.SelectedIndex = 0; } private void SerialNameSelect() { string[] ports = SerialPort.GetPortNames(); foreach (string port in ports) { SerialNumber.Items.Add(port); } } private void SelectPortStopBits() { foreach (string s in Enum.GetNames(typeof(StopBits))) { SerialStopBits.Items.Add(s); } } private void SelectHandShake() { foreach (string s in Enum.GetNames(typeof(Handshake))) { SerialHandShoke.Items.Add(s); } } private void SelectParity() { foreach (string s in Enum.GetNames(typeof(Parity))) { SerialParity.Items.Add(s); } }。。。。。。。。。。
- 1
- 粉丝: 1
- 资源: 4
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助