通过 USB 访问串行端口
我想访问通过 RS232 串行端口连接的秤。我正在编写 C# 代码的机器没有串行端口,因此我打算使用 USB 转串行端口适配器。我的代码需要更改什么吗?
I want to access a scale hooked up via a RS232 Serial Port. The machine I'm writing the C# code on does not have a serial port, so I was going to use a USB to Serial Port dongle. Will anything need to be changed with my code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,它们在驱动程序级别模拟串行端口。您的代码和 SerialPort 类都不会知道其中的区别。您必须抵制的唯一诱惑是在端口打开时拔下 USB 电缆。这与在 Windows 写入闪存时拔出闪存棒一样有效。无论如何,你的客户都会这样做,但他们通常会在几次后感到厌倦。
No, they emulate a serial port at the driver level. Your code, nor the SerialPort class, won't know the difference. The only temptation you'll have to resist is unplugging the USB cable while the port is opened. That works about as well as unplugging a flash memory stick while Windows is writing to it. Your customer will do it anyway, but they usually get bored with it after a couple of times.