确定设备锁定的 COM 端口

发布于 2024-10-03 23:13:14 字数 87 浏览 0 评论 0原文

我有一个微控制器(Arduino),希望自动确定微控制器锁定到哪个端口。这个想法是不必为每台计算机上的每个应用程序手动更正 COM 端口。这可以做到吗?谢谢 !

I have a micro-controller (Arduino) and wish to determine automatically to which port the micro-controller locks to. The idea is not to have to correct the COM port manually for every app on every computer. Can this be done ? Thanks !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

離殇 2024-10-10 23:13:14

您的意思是:

  • 微控制器是一个外部硬件设备
  • 用户将该设备插入随机串行端口(COM 端口)
  • 您想知道它连接到哪个 COM 端口

另外,你说的是老式COM端口,不是USB吗?

无论如何,如果这是你的问题,唯一的方法是:

  • 打开机器上的每个 COM 端口并通过它发送数据,以查看(如果微控制器发回预期的响应)它是否正在与预期的设备通信(例如如果设备是调制解调器,您可以尝试发送“AT\r”并期望如果有调制解调器并且调制解调器已连接到该串行端口,则调制解调器会响应“OK”)。
  • 和/或编写设备驱动程序或服务来执行此操作,而不是应用程序。

Do you mean:

  • Micro-controller is an external hardware device
  • User plugs the device into a random serial port (COM port)
  • You want to know which COM port it's connected to

?

Also, you are talking about an old-style COM port, are you, not a USB?

Anyway if that is your question, the only way would be to:

  • Open each COM port on the machine and send data through it, to see (if the micro-controller sends back the expected resonse) whether it's talking to the expected device (e.g. if the device were a modem you might try sending "AT\r" and expect a modem to respond "OK", if there is a modem and if the modem is connected to that serial port).
  • And/or write a device driver or a service to do just this, instead of an application.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文