windows “COM”、“USB”、“串口”有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27937916/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What's the difference between "COM", "USB", "Serial Port"?
提问by smwikipedia
I am confused about the these 3 concepts.
我对这三个概念感到困惑。
My understanding is, Serial Port
usually means RS-232 compatible port (RS = Recommended Standard). USB
stands for Universal Serial Bus
. So its name contains serial port, does it support RS-232? What does the Universal
mean?
我的理解是,Serial Port
通常是指 RS-232 兼容端口(RS = 推荐标准)。USB
代表Universal Serial Bus
. 所以它的名字包含串口,它支持RS-232吗?这是什么Universal
意思?
And what does COM port mean?
COM 端口是什么意思?
ADD 1
添加 1
Some understanding from Hans' answer:
从汉斯的回答中得到一些理解:
To reduce effort, device manufacturers usually make their device can behave like a serial port device as well. This relies on the the fact that many OS and language libraries have already included serial port communication support. Though such support is no comparable to a real matching device driver.
为了减少工作量,设备制造商通常使他们的设备也可以像串行端口设备一样工作。这依赖于许多操作系统和语言库已经包含串行端口通信支持的事实。尽管这种支持无法与真正匹配的设备驱动程序相提并论。
ADD 2
添加 2
A good reference doc about Serial Port HOW-TO.
关于Serial Port HOW-TO 的一个很好的参考文档。
And btw, the Linux Document Projectis really useful.
顺便说一句,Linux 文档项目真的很有用。
回答by Hans Passant
Serial port
is a type of device that uses an UART chip, a Universal Asynchronous Receiver Transmitter. One of the two basic ways to interface a computer in the olden days, parallel ports were the other way. Serial is simple to hook up, it doesn't need a lot of wires. Parallel was useful if you wanted to go fast, typ 8 times faster than serial, but cables and connectors were expensive. Parallel I/O has completely disappeared from computer designs, caught up by tremendous advances in bus transceivers, the kind of chip that can transmit an electrical signal down a wire.
Serial port
是一种使用 UART 芯片的设备,通用异步接收器发送器。过去连接计算机的两种基本方式之一,并行端口是另一种方式。串口连接起来很简单,不需要很多电线。如果您想快速运行,并行很有用,通常比串行快 8 倍,但电缆和连接器很贵。并行 I/O 已从计算机设计中完全消失,被总线收发器的巨大进步所追赶,总线收发器是一种可以通过电线传输电信号的芯片。
COM
comes from MS-Dos, it is a device name. Short for "COMmunication port". Computers in the 1980's usually had two serial ports, labeled COM1 and COM2 on the back of the machine. This name was carried forward into Windows, most any driver that simulates a serial port will create a device with "COM" in its name. LPT
was the device name for parallel ports, short for "Line PrinTer".
COM
来自 MS-Dos,它是一个设备名称。“通信端口”的缩写。1980 年代的计算机通常有两个串行端口,机器背面标有 COM1 和 COM2。这个名称被继承到 Windows 中,大多数模拟串行端口的驱动程序都会创建一个名称中带有“COM”的设备。 LPT
是并行端口的设备名称,“行打印机”的缩写。
RS-232
was an electrical signaling standard for serial ports. It is the simplest one with very low demands on the device, supporting just a point-to-point connection. RS-422 and RS-485 were not uncommon, using a twisted pair for each signal, providing much higher noise immunity and allowing multiple devices connected to each other.
RS-232
是串行端口的电气信号标准。它是最简单的,对设备的要求非常低,只支持点对点连接。RS-422 和 RS-485 并不少见,它们为每个信号使用双绞线,提供更高的抗噪性并允许多个设备相互连接。
USB
means Universal Serial Bus. Empowered by the ability to integrate a micro-processor into devices that's a few millimeters in size and costs a few dimes. It replaced legacy devices in the latter 1990s. It is Universal because it can support many different kinds of devices, from coffee-pot warmers to disk drives to wifi adapters to audio playback. It is Serial, it only requires 4 wires. And it is a Bus, you can plug a USB device into an arbitrary port. It competed with FireWire, a very similar approach and championed by Apple, but won by a land-slide.
USB
表示通用串行总线。能够将微处理器集成到几毫米大小、几毛钱的设备中。它在 1990 年代后期取代了传统设备。它是通用的,因为它可以支持许多不同类型的设备,从咖啡壶加热器到磁盘驱动器,再到 wifi 适配器到音频播放。它是串行的,只需要4根线。它是一个总线,您可以将 USB 设备插入任意端口。它与 FireWire 竞争,这是一种非常相似的方法,由 Apple 支持,但以压倒性优势获胜。
The only reason that serial ports are still relevant in on Windows these days is because a USB device requires a custom device driver. Device manufacturers do notlike writing and supporting drivers, they often take a shortcut in their driver that makes it emulate a legacy serial port device. So programmers can use the legacy support for serial ports built into the operating system and about any language runtime library. Rather imperfect support btw, these emulators never support plug-and-play well. Discovering the specific serial port to open is very difficult. And these drivers often misbehave in impossible to diagnose ways when you jerk a USB device while your program is using it.
如今,串行端口在 Windows 上仍然相关的唯一原因是 USB 设备需要自定义设备驱动程序。设备制造商不喜欢编写和支持驱动程序,他们经常在驱动程序中采用快捷方式,使其模拟传统的串行端口设备。因此,程序员可以使用对操作系统内置的串行端口和任何语言运行时库的遗留支持。顺便说一句,这些模拟器支持不完善,从来没有很好地支持即插即用。发现要打开的特定串行端口非常困难。当您在程序使用 USB 设备时猛拉 USB 设备时,这些驱动程序通常会以无法诊断的方式出现异常行为。
回答by Clifford
USB stand for Universal Serial Busnot Port. The term "serial port" simply means that the data is transferred one bit at a time over a single signal path - in that sense even Ethernet is serialin nature. The word serialin both terms implies no relationship other the width of the data path.
USB 代表通用串行总线而非端口。术语“串行端口”仅表示数据通过单个信号路径一次一位地传输 - 从这个意义上说,即使以太网本质上也是串行的。这两个术语中的串行一词意味着除了数据路径的宽度之外没有任何关系。
You are right in that the term serial-portin the context of a PC normally means an RS-232 port, but there are other serial port standards such as RS-422 and RS-485 often used in industrial applications. What these have in common is that they are implemented using a UART (Universal Asynchronous Receiver/Transmitter).
您是对的,PC 上下文中的术语串行端口通常表示 RS-232 端口,但还有其他串行端口标准,例如工业应用中经常使用的 RS-422 和 RS-485。它们的共同点是使用 UART(通用异步接收器/发送器)实现。
The term Universalin USB merely reflects the fact that it is not a specific device interface such as the dedicated mouse or keyboard ports found on older hardware. Similarly a UART based serial port is not device specific, reflected by the U in UART.
USB 中的通用术语仅反映了这样一个事实,即它不是特定的设备接口,例如旧硬件上的专用鼠标或键盘端口。类似地,基于 UART 的串行端口不是特定于设备的,由 UART 中的 U 反映。
USB differs significantly from RS-232 in a number of ways; it is a master/slave (or host/device in USB terminology), rather than peer-to-peer, the USB device cannot initiate communication, it must be polled by the host. USB includes a low-voltage power supply to allow devices with moderate power requirements to be powered by the bus - that is also why USB ports can be used for charging battery powered devices. USB is significantly more complex that RS-232 which defines only the physical (hardware) layer whereas USB requires a complete software protocol stack.
USB 在许多方面与 RS-232 有很大不同。它是主/从(或 USB 术语中的主机/设备),而不是点对点,USB 设备无法发起通信,必须由主机轮询。USB 包括一个低压电源,允许具有中等功率要求的设备由总线供电 - 这也是 USB 端口可用于为电池供电设备充电的原因。USB 比 RS-232 复杂得多,RS-232 仅定义物理(硬件)层,而 USB 需要完整的软件协议栈。
The term COM is just a device name prefix used in Windows (and previously MS-DOS) for a serial (UART) port. Short for "communications", you can for example open a COM port as a stream I/O device with say FILE* port = fopen( "COM1", "wr" ) ;
.
术语 COM 只是在 Windows(以及以前的 MS-DOS)中用于串行 (UART) 端口的设备名称前缀。“通信”的缩写,例如,您可以使用 say 将 COM 端口作为流 I/O 设备打开FILE* port = fopen( "COM1", "wr" ) ;
。