如何调用RJ45作为串口进行接口?
我目前正在开发一个基于连接到 rs232 端口的串行接口项目。 然而,考虑到相当数量的笔记本电脑和/或 PC 的 RS232 端口可能会在未来 5 年内消失,我正在考虑在我的项目中使用 RJ45 模块化端口 (EIA/TIA 568)。 但是,我不太确定通过 Win32API 访问端口时如何命名它(我正在用 C++ 编程)。 当前已编程为“COM1”。 有谁知道我如何找到这个端口的名称或如何配置它以便可以以这种方式使用它?
I'm currently working on a serial interfacing project based upon connecting to the rs232 port. However, seeing as a decent number of laptops and/or PC's seem like they might have their rs232 ports disappear within the next 5 years, I was considering using the RJ45 modular port for my project (EIA/TIA 568). However, I'm not quite sure how to denominate it when accessing the port through the Win32API (I'm programming in C++). It's currently programmed to "COM1". Does anyone know how I can find out what this port is called or how to configure it so it can be used in this manner?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我真的很困惑...笔记本电脑/PC 上的 RJ45 端口用于以太网连接,不是吗? 我不明白你如何将其用作 COM 端口。
如果您需要串行端口,并且不需要超低延迟*,请选择 USB <-> RS232 转换器,价格约为 20-30 美元,并且工作得很好:从 PC 软件的角度来看,它看起来就像一个普通的旧 COM 端口。
*RS232本身具有低延迟,但如果您使用USB作为串行连接的一部分,您会受到其帧的时序以及USB串行转换器如何使用它们的限制...我似乎记得USB有1毫秒和16毫秒的帧定时; USB 2.0 似乎有 125usec 微帧,但我不知道是否有串行转换器能够使用它们。 如果您在 RS232 中使用具有大量来回流量的命令响应协议,则会遇到延迟问题。
I'm really confused... RJ45 ports on laptops/PCs are for Ethernet connections, aren't they? I don't understand how you could utilize one as a COM port.
If you need a serial port, and don't need ultra-low latency*, pick up a USB <-> RS232 converter, they run about $20-$30 and work just fine: from the PC software's point of view it looks like a regular old COM port.
*RS232 itself has low latency, but if you use USB as part of the serial connection, you're limited by the timing of its frames and how the USB serial converter uses them... I seem to remember USB has 1msec and 16msec frame timing; USB 2.0 appears to have 125usec microframes but I don't know if any of the serial converters manage to use them. You'd run into latency issues if you're using a command-response protocol in RS232 with lots of back-and-forth traffic.
在过去几年中,USB 端口已开始接管 RS-232 的职责。
您应该认真考虑将 USB 作为您项目的接口。
哦,是的; 这似乎是一个明显可笑的说法——“呃!十年来没有人使用 Serial”。
没那么容易:除了鼠标和打印机之外还有很多东西。
在每个人开始将 USB 用于鼠标和大批量消费设备之后很久,RS-232 就一直是定制设备、科学仪器和低产量设备的首选接口。
我最直接的经验来自业余天文学和为视障人士提供的无障碍电脑配件。 直到不久前,上述所有设备仍然主要是 RS232 设备,而一个常见的头痛问题是找到一种将这些设备插入现代笔记本电脑的方法。 RS232 转 USB 消费类适配器有时可以工作,有时则不行。 至少有一家辅助设备制造商(盲文压印机)向我们表示,他们不推荐 RS232 转 USB 适配器,因为他们在使用这些适配器时遇到了(未具体说明的)问题。
我不知道原因。 也许 USB 组件更昂贵,也许需要与旧设备连接,重新设计成本高昂; 也许这就是工程师所知道的。 也许这只是“没有坏,不要修理它”或简单的惯性。
直到最近几年,我才终于看到许多此类设备配备了 USB 端口,而不是串行 RS232; 在某些情况下,RS-232 版本已停产。 只是需要更长的时间。
The USB port has been starting to take over the duties of RS-232 for the last few years.
You should seriously consider USB as an interface for your project.
Oh, yes; that might seem like a ludicrously obvious statement -- "duh! nobody's been using Serial for a decade now".
Not so easy: there is a lot more than mice and printers out there.
RS-232 has been the preferred interface for custom-build devices, scientific instruments, and low-production devices far long after everybody started using USB for mice and high volume consumer devices.
My most direct experience comes from amateur astronomy and accessibility computer accessories for the visually-impaired. Until not too long ago, all of the above were still mainly RS232 devices, and a common headache has been finding a way to plug those in a modern laptop. RS232-to-USB consumer adapted will sometimes work, sometimes not. At least one manufacturer of accessibility devices (a braille embosser) has stated to us that they don't recommend RS232-to-USB adapters because they have had (unspecified) problems with them.
I don't know the cause. Maybe USB components are more expensive, maybe it's the need to interface with legacy devices that would be expensive to redesign; maybe it's what the engineers know. Maybe it's just "ain't broken, don't fix it" or simple inertia.
It's only been in the last couple of years, but I've finally seen a number of these devices offered with USB ports instead of serial RS232; in some cases, RS-232 versions have been discontinued. It's just taking a little longer.
在元层面上,你想做的事情是一个坏主意。 您正在发明自己的硬件标准,其方式与既定协议完全不一致。
最好直接使用 USB 或带有 RS-232 的 DB-9 连接器。 RS-232 确实相当不错,但它已经过时了(不幸的是,它比 USB 简单得多)。
对于畅销产品,您希望两者都拥有。 对于研究/极客产品,USB 更好。
您应该能够从 Windows 枚举您的 com 端口并将给定的 com 端口作为文件打开(我已经做到了)。
On the meta level, what you want to do is a bad idea. You're inventing your own standard for hardware, in a manner which is wholly inconsistent with established protocols.
You are much better directly using either USB or a DB-9 connector with RS-232. RS-232 is really quite good, but it's getting outdated(unfortunately, it's much simpler than usb).
For salable products, you'd want to have both. For researchy/geek products, USB is much better.
You should be able to enumerate your com ports from Windows and open a given com port as a file(I've done it).
你说的RJ45口是以太网口,不是串口。
如果您正在寻找更新的技术,您应该研究 USB 接口。 如果您确实需要以太网,您可能会对 XPort< /a> 来自 Lantronix。
-- 编辑 --
您希望使用什么类型的设备作为主机?
您担心老化但通用的标准 (RS-232) 会消失,但您打算使用非标准,但事实并非如此?
您参考的文档似乎是典型 RS-232 端口的替代接线方法。
顺便说一句,您所说的 RJ-45 是一种接线标准,而不是接口。 RS-232 可通过 DB-9、DB-25、RJ-45 或螺丝端子连接。 电压和信号是协议的一部分。 连接器类型更多地取决于便利性。
大多数计算机使用 RJ-45 进行以太网连接。 我唯一一次看到用于串行连接的 RJ-45 连接是在网络设备或终端服务器上。
The RJ45 port you are referring to is an Ethernet port, not a serial port.
If you are looking for a more current technology, you should investigate the USB interface. If you really want Ethernet, you might be interested in the XPort from Lantronix.
-- Edit --
What type of device are you looking to use as a host?
You're worried about an aging but common standard (RS-232) going away, but you're going to use a non-standard, that never was?
The documents you refer to appear to be an alternate wiring method for a typical RS-232 port.
By the way what you're referring to as RJ-45 is a wiring standard not an interface. RS-232 can be connected via DB-9, DB-25, RJ-45 or screw terminals. The voltages and signaling are part of the protocol. The connector type is determined more by convenience.
Most computers use an RJ-45 for ethernet. The only time I've seen RJ-45 connections for serial connections was on networking equipment or terminal servers.
http://site.gridconnect.com/docs/PDF/xportmanual.pdf
您可以通过阅读本手册获得一些想法。
该制造商与产品通信的方式是通过摄像机上的 RS-232 端口和以太网连接。 该插件结合了连接软件和带有示例的插件。
虽然我想拥有这个设置,但我尝试自己制作而不是购买。
您可能只是考虑购买该产品,然后将其通信方式和插头接线或至少从串行到局域网的转换作为有效的解决方案这一事实。
我还拥有一台笔记本电脑,我想通过 rs-232(25 针串行)和笔记本电脑上的 LAN 连接与 CNC 机床通信。
这并不是要让过去继续存在,也不是说哪个标准比另一个标准更好或更差。
它涉及如何使用笔记本电脑运行 CNC 机床,以及如何将 RS-232 连接到笔记本电脑上的 LAN 45rj(九针连接器)以及使用什么软件来实现这一点。
::::::笔记::::::
我还希望能够使用使用其他连接的 Microsoft sidewinder 操纵杆; 一个“”“”游戏端口“”“”另一个让事情变得更容易的失败尝试。运行CNC以用作CMM或计算机测量机。
一个鲜为人知的事实是,人们应该只提供信息,如果他们知道什么他们正在谈论。
http://site.gridconnect.com/docs/PDF/xportmanual.pdf
you mite get some ideas from reading this manual.
the way this manufacturer communicates with the product is by the rs-232 port on the camera and the Ethernet connection. the plug combines both the software to connect and the plug with samples.
Although I would like to have this setup , I am trying to make it myself rather than buying it.
You may just consider buying the product and just shairing back to this thread the way they comuncate and the wireing of the plug or at least the fact that the conversion from serial to lan a valid solution.
I am also with a laptop that I want to talk to a CNC machine by way of rs-232 (25 Pin serial) and the LAN connection on the laptop.
It is not about keeping the past alive or saying whitch standard is better or worse than another.
It's about being able to run the CNC machine with the laptop and How to wire the RS-232 to the LAN 45rj - nine pin connector on the laptop and what software to use to make it happen.
::::::NOTE::::::
Also I wish to have the ability to use a Microsoft sidewinder joy stick that uses another connection ; a """" A Game Port """"" another failed attempt to make things easier. Run the CNC for use as a CMM or Computer Measuring Machine.
A little known fact is that people should only give information , if they know what they are talking about.
也许您正在考虑这样的事情...
http://www.comtrol.com /产品/规格/30130-1
朱利安诺丛林
Maybe you are thinking about something like this...
http://www.comtrol.com/products/specifications/30130-1
Julianno Jungle
如果我错了,请纠正我,但是 Yost 接线标准是否不允许连接到 RJ45 端口以进行串行通信?
http://yost.com/computers/RJ45-serial/
http://www.lammertbies.nl/comm/cable/yost-serial-rj45.html
我想知道的是如何从 win32 API 实际访问该端口。 我在这里是不是太离谱了?
– 尼古拉斯·沙利文
Correct me if I'm wrong, but does the Yost wiring standard not allow one to connect to an RJ45 port in order to do serial communications?
http://yost.com/computers/RJ45-serial/
http://www.lammertbies.nl/comm/cable/yost-serial-rj45.html
All I'm wondering is how to actually access the port from the win32 API. Am I terribly off base here?
– Nicholas Sullivan