如何将 com 端口数据路由到 USB 端口(用于导出 GPS 数据)
我的戴尔笔记本电脑有一个内置 GPS 卡,可通过 COM 4 输出 NMEA GPS 信息。我想捕获 COM4 流量并将其发送到 USB 端口,然后将 USB 端口连接到 NMEA 兼容设备(VHF 无线电)。我将使用 .NET 捕获数据并将其路由到 USB 端口,除非已经有实用程序/驱动程序可以执行此操作。
所以我有几个问题:
我认为捕获 COM 端口数据应该相当简单,因此问题是将其发送到 USB 端口 - 这导致了我的下一个问题
NEMA 设备使用 2 根电线,我想这将对应于数据 + 和数据- USB 的,所以我想我可以自己接线。
那么...使用 .NET 将 COM 数据中继到 USB 端口需要什么,
并且...我的 USB 电缆接线计划是否有效(我的意思是电气)
听起来我走在正确的轨道上吗?我想知道这样的实用程序是否已经存在,这似乎是一个常见的需求,将硬件生成的 com 端口数据转换为 USB。
欢迎任何建议!
My dell laptop has an internal GPS card that outputs NMEA GPS info over COM 4. I want to capture the COM4 traffic and send it to a USB port, then connect the USB port to a NMEA compatible device (a VHF radio). I will be using .NET to capture the data and route it to the USB port, unless there is already a utility/driver that does this.
So I have a few issues:
I think it should be fairly straight forward to capture the COM port data, and so the problem is sending it to a USB port - which leads to my next problem
NEMA devices use 2 wires, I suppose this will correspond to the data + and data - of the USB, so I think I could wire that up myself.
So... what is required to relay COM data to an USB port using .NET
and... will my plan for wiring the USB cable work (electrically, I mean)
Do it sound like I'm on the right track? I wonder if a utility like this already exists, it seems like a common need, convert hardware generated com port data to usb.
Any advice welcome!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 USB,您无法像使用 COM 端口那样直接访问物理端口的 tx/rx 线。您的设备需要真正支持 USB。可以购买 USB-> 串行加密狗,它将自身呈现为另一个 COM 端口。那么将数据从一个 COM 端口复制到另一个 COM 端口就相当简单了。
With USB you do not have direct access to the tx/rx wires of the physical port like you do with a COM port. Your device would need to actually support USB. It is possible to buy a USB->serial dongle which would present itself as another COM port. Then it would be fairly trivial to copy the data from one COM port to another.
了解您的甚高频无线电的型号将有所帮助。通常 VHF 无线电通过无线电上的串行端口接收 NMEA 输入,但它通常没有这样的标签,名称如“ground”和“nmea in”。 USB 有时用于输出 NMEA(并在笔记本电脑上创建虚拟串行端口)或用于使用笔记本电脑和无线电附带的自定义软件来控制无线电。
如果您的收音机实际上具有标准 NMEA 输入线,并且您的笔记本电脑具有真正的 COM4 端口,那么您需要将正确的电线从 COM 端口连接到您的收音机 - http://en.wikipedia.org/wiki/Com_port 告诉您哪根线适合您的笔记本电脑,并且您想要将 latop:tx 连接到 radio:NMEA和笔记本电脑:rx 到无线电:NMEA 输出。并确保两个设备的波特率相同(NMEA 过去默认波特率为 4800,但现在可以是 9600 或 36400 甚至更高)。
但笔记本电脑上的 COM4 GPS 端口可能是虚拟端口。在这种情况下,如果有的话,您需要将其重定向到真实端口(例如 COM1),或者购买“USB 转串行转换器”(在 google 上搜索该短语)并将 COM4 重定向到该端口。然后接线工作是一样的。但重定向会很棘手——有软件可以实现。
如果您的收音机确实希望通过 USB 接收 NMEA,那么它应该附带软件,询问您希望它连接到哪个串行端口 - 那么您选择 COM4(这是迄今为止最简单的情况)。或者,当您插入 USB 电缆时,它可能会创建自己的虚拟串行端口。您可能运行的是 Windows,因此在插入时请检查控制面板中的设备管理器中的端口(COM 和 LPT),看看是否出现新的串行端口,以及它的 COM 号是什么。然后您需要一些软件将两个虚拟端口连接在一起。
至于我提到的所有重定向和虚拟端口软件 - 有免费软件 com0com 和销售串行端口软件的 eltima.com。您也许可以在那里找到其他东西。或者您必须学习低级串行端口驱动程序编程,这可能很棘手。祝你好运。
It would help to know what model your VHF radio is. Usually VHF radios receive NMEA input through a serial port on the radio, but it's often not labelled as such, with names like "ground" and "nmea in". The USB is sometimes for outputting NMEA (and creates a virtual serial port on your laptop) or for controlling the radio using your laptop with custom software that came with the radio.
If your radio actually has the standard NMEA input lines, and your laptop has a real COM4 port then you need to connect the correct wires from the COM port to your radio - http://en.wikipedia.org/wiki/Com_port tells you which wire is which for your laptop, and you want to connect latop:tx to radio:NMEA in and laptop:rx to radio:NMEA out. And make sure the baud rates are the same for the two devices (4800 used to be default for NMEA, but it can be 9600 or 36400 or even higher these days).
But the COM4 GPS port on your laptop is probably a virtual port. In this case you need to redirect it to a real port if you have one (e.g. COM1), or buy a "USB to serial converter" (search for that phrase on google) and redirect COM4 to that. Then the wiring job is the same. But redirecting is going to be tricky - there is software out there.
And if your radio genuinely expects to receive NMEA over USB, then either it should come with software that asks you which serial port you want it to connect to - so then you select COM4 (this is by far the simplest scenario). Or it might create its own virtual serial port when you plug in the USB cable. You're probably running Windows, so check on the Device Manager in Control Panel under Ports (COM &LPT) when you plug it in to see if a new serial port appears, and what it's COM number is. And then you need some software to connect the two virtual ports together.
As for all the redirect and virtual port software that I mention - theres com0com which is freeware, and eltima.com who sell serial port software. You might be able to find other stuff out there. Or you have to learn about low level serial port driver programming, which is likely to be tricky. Good luck.