3 ms·
COM1 = CreateFile("COM1", ...) => Nice! COM9 = CreateFile("COM9", ...) => Nice! COM10 = CreateFile("\\\\.\\COM10", ...) => NOT nice!
by scoutt 3y ago
COM1 = CreateFile("COM1", ...) => Nice!
COM9 = CreateFile("COM9", ...) => Nice!
COM10 = CreateFile("\\\\.\\COM10", ...) => NOT nice!
- Kwpolska 3y agoHow often do you end up with 10 COM ports?
- zwieback 3y agoWe do all the time. In industrial automation COM ports are still shockingly popular, although it's usually the USB emulated variety. On a lot of our development and on some of our production tools we end up with COM20 or COM30, not because we have that many running at one time but because over time we've plugged in that many distinct devices. Nowadays most drivers will assign COM(n+1) when they see a device with a new serial number.
- connicpu 3y agoUART is available on nearly every microcontroller under the sun, and USB<->UART serial chips are super cheap, so it makes complete sense to me that'd become the defacto system for interfacing the automation controller with a computer
- InitialLastName 3y agoEven beyond that, USB is available on many microcontrollers, a USB CDC device is dead simple to implement, the drivers are baked into every modern OS, and all the software developers operating at that layer already know how to interact with text streams. Add in the ease of debugging when you can just manually send/receive ASCII to operate a device, and you've got the makings of a standard practice.
- rogerbinns 3y agoIf you use USB dongles for serial adapters, then each path through USB is assigned a different COM number when you plug it in. For example if you plug into USB controller 2, port 3 which goes to a hub, and then you plug into port 2 that gets a number. Now plug the same thing into a different port and it will get another COM number. Under the hood this is because the USB devices do not have the (optional) unique serial number (or in some cases they all get the same serial number). https://devblogs.microsoft.com/oldnewthing/20041110-00/?p=37343 https://devblogs.microsoft.com/oldnewthing/20041110-00/?p=37...