C#winform小demo-串口传输实现硬件数据回传(SerialPort类使用)

这节介绍实现的是利用SerialPort类进行串口的链接。

.Net Framework 作为微软开发的一个框架,万变不离其宗,要怎么使用一个东西,就最好看它的说明书 。   

SerialPort Class 的文档链接:https://docs.microsoft.com/en-us/dotnet/api/system.io.ports.serialport?view=netframework-4.5

 

它的示例介绍写着:

The following code example demonstrates the use of the SerialPort class to allow two users to chat from two separate computers connected by a null modem cable. In this example, the users are prompted for the port settings and a username before chatting. Both computers must be executing the program to achieve full functionality of this example.

提取重点就是:两个计算机的users 通过使用SerialPort class 去进行聊天 ,两个电脑通过的是a null modem cable(这里应该指的是串口线,因为RS232线的名字是RS232 Cable (Null Modem Cable))进行连接。

我们现阶段主要实现的从串口中获取数据,写数据暂时不需要,所以我们可以在里面提取我们需要的部分。

在文档的左侧,我们可以选择其方法和事件来选择我们所需要的实例

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值