| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 780 人关注过本帖
标题:求C#串口编程的实例代码
只看楼主 加入收藏
王907540667
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2013-4-28
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
求C#串口编程的实例代码
要求通过程序代码设置好串口号,波特率,发送16进制数据,然后接收16进制数,并16进制显示。
搜索更多相关主题的帖子: 波特率 编程 
2013-04-28 17:33
王907540667
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2013-4-28
收藏
得分:0 
各位大侠,帮帮我吧
2013-04-28 17:34
一介草莽
Rank: 2
等 级:论坛游民
帖 子:20
专家分:60
注 册:2012-10-8
收藏
得分:20 
serialPort1.PortName = comboBox1.SelectedItem.ToString();
                        serialPort1.BaudRate = Convert.ToInt32(comboBox2.SelectedItem.ToString());
                        switch (comboBox3.SelectedIndex)
                        {
                            case 0:
                                serialPort1.Parity = Parity.None;
                                break;
                            case 1:
                                serialPort1.Parity = Parity.Odd;
                                break;
                            case 2:
                                serialPort1.Parity = Parity.Even;
                                break;
                            case 3:
                                serialPort1.Parity = Parity.Mark;
                                break;
                            case 4:
                                serialPort1.Parity = Parity.Space;
                                break;
                        }

                        serialPort1.DataBits = Convert.ToInt32(comboBox4.SelectedItem.ToString());

                        switch (comboBox5.SelectedIndex)
                        {
                            case 0:
                                serialPort1.StopBits = StopBits.One;
                                break;
                            case 1:
                                serialPort1.StopBits = StopBits.Two;
                                break;
                            case 2:
                                serialPort1.StopBits = StopBits.OnePointFive;
                                break;
                        }
                        serialPort1.Open();
2013-05-04 17:18
快速回复:求C#串口编程的实例代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.049923 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved