What are the min/max COM ports?

I am currently creating a program in C++ that will communicate with the Arduino over USB. The user needs to be able to change the COM port to the one that arduino is connected to. I am guessing the first COM port that arduino can show up on is COM1 (although I know that it's usually 3 or more, as COM1 and COM2 are used for hardware serial). But what is the highest? The max amount of serial ports on most windows OS's is 256, but I don't want to have a list with 256 options. What is the most common maximum for a COM port on arduino? I think I have seen some pople get it on 13 or even 14, but I'm not sure.

It all depends on what computer you've got. I've seen processors that go up to COM10; others go up to even COM19. So just decide on a reasonable number yourself. I have noticed that COM10 is a good limit for number of COM ports, because a lot of older hardware does not have more than 10 COM ports.

goodinventor:
It all depends on what computer you’ve got. I’ve seen processors that go up to COM10; others go up to even COM19. So just decide on a reasonable number yourself. I have noticed that COM10 is a good limit for number of COM ports, because a lot of older hardware does not have more than 10 COM ports.

Thanks!

One thing I’ve heard is that once you start going into COM10 and higher, you need to make the port something like \\.\COM10. Is this true or am I just babbeling here?

I have FTDI modules that regularly connect to COM24. It almost seems the COM port follows the module. I see 7, 10, 24 on the cards I have handy that I use a lot.

No, not at all. The labeling for COM port 10 is COM10. Unless you have some strange processor that does not follow standard labeling, COM ports are labeled COM1…COM10, COM11…COM27, etc.

goodinventor:
No, not at all. The labeling for COM port 10 is COM10. Unless you have some strange processor that does not follow standard labeling, COM ports are labeled COM1...COM10, COM11...COM27, etc.

Oh, okay. I must have read some crazy text then. Thanks for the help.

CrossRoads:
I have FTDI modules that regularly connect to COM24. It almost seems the COM port follows the module. I see 7, 10, 24 on the cards I have handy that I use a lot.

I wonder why they dont just connect to the lowest number... I think I will leave it at COM10 max, and if someone needs higher they can always change it in the settings file manually.

That sounds like a good plan.

you need to make the port something like \\.\COM10. Is this true or am I just babbeling here?

That is true. goodinventor doesn’t know what he’s talking about.
I use a sprintf in code like this to generate the correct string depending upon whether the COM port number is less than 10 or not.

if(devnum < 10)sprintf(dev_name,"COM%d",devnum);
else           sprintf(dev_name,"\\\\.\\COM%d",devnum);

Pete

CrossRoads:
It almost seems the COM port follows the module.

I've noticed that too. I have several Teensies, a couple of Nanos, etc. when I plug them in (Windows 7 Pro X64), they have the same COM port number that they were assigned when they were first plugged in. I suspect that there's a unique number associated with the USB hardware on the board which Windows then allocates to, and associates with, that board forever after.

Pete