通过串口发送数据
我正在做一些监视项目...我需要在两个系统之间进行一些串行端口数据通信...在这里我可以在我的系统中找到可用的 com 端口,我需要通过它发送和接收一些数据...是否可以在 .净框架1.1? 有什么选择吗?
System.IO.Ports 不可用 .net 1.1
am doing some surveillance project... i need to make some serialport data communication between two systems ... here i could find available com ports in my system through which i need to send and receive some data...is it possible in .net framework 1.1 ? is there is any option?
System.IO.Ports is not available .net 1.1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当我需要在 1.1 中做一些串口工作时,我发现 Noah Coad 写的一篇文章使用了 MSComm OCX 控件,最终对我有用。 您可以在 http://www.devhood.com/tutorials/ 找到他的文章tutorial_details.aspx?tutorial_id=320。 祝你好运!
When I needed to do some serial port work back in 1.1, I found an article written by Noah Coad that uses the MSComm OCX control and that ended up working for me. You can find his article at http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=320. Good luck!
对于.net 1.1,我使用 OpenNETCF.IO.Serial 因为在 2.0 版本中.net 添加了串行支持。 它适用于紧凑型框架,但我将它用于紧凑型设备和常规 Windows 应用程序。 你可以获得源代码,这样你就可以自己修改它,这就是我所做的。
它基本上围绕从 kernel32.dll 导入的串行函数创建 ac# 包装器。
您可能还想看看如何捕获因 USB 电缆被拔出而消失的串行端口
这是代码我以前叫它
For .net 1.1 I used OpenNETCF.IO.Serial because serial support was added to .net in version 2.0. It is for the compact framework but I used it for both compact devices and regular windows apps. You get the source code so you can modify it yourself which is what I did.
It basically creates a c# wrapper around the serial function imported out of kernel32.dll.
You might also want to have a look at How to capture a serial port that disappears because the usb cable gets unplugged
Here is the code that I used to call it
您是否受限于 .NET 1.1? 如果您可以使用 .NET 2.0,则可以使用 SerialPort.GetPortNames 方法检索本地主机上的串行端口列表。 SerialPort 类位于 System.IO.Ports 命名空间。
Are you constrained to .NET 1.1? If .NET 2.0 is available to you, you can use the SerialPort.GetPortNames method to retrieve a list of serial ports on the local host. The SerialPort class is in the System.IO.Ports namespace.