金牌会员
 
- 积分
- 1635
- 金钱
- 1635
- 注册时间
- 2012-8-28
- 在线时间
- 71 小时
|

楼主 |
发表于 2020-6-4 01:41:03
|
显示全部楼层
//2波特率
comboBox2.Items.Add(110);//0索引
comboBox2.Items.Add(4800);//1
comboBox2.Items.Add(9600);//2
comboBox2.Items.Add(115200);//3
//comboBox2.Items.Add();
//comboBox2.Items.Add();
//comboBox2.Items.Add();
comboBox2.SelectedIndex = 2;//默认选择的波特率
//3数据位
comboBox3.Text = usart.DataBits.ToString();//默认数据位
comboBox3.Items.Add(5);//索引0
comboBox3.Items.Add(6);//1
comboBox3.Items.Add(7);//2
comboBox3.Items.Add(8);//3
//4校验位
comboBox4.DataSource = Enum.GetNames(typeof(Parity));//校验位
//5停止位
comboBox5.DataSource = Enum.GetNames(typeof(StopBits));//停止位
comboBox5.SelectedIndex = 1;//索引
//6硬件协议
comboBox6.DataSource = Enum.GetNames(typeof(Handshake));//绑定枚举参数
comboBox6.SelectedIndex = 0;
//接收事件
usart.DataReceived +=new SerialDataReceivedEventHandler(usart_DataReceived);//触发事件绑定函数 |
|