Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Emulating a Comm port with a USB port - how to do?

Status
Not open for further replies.

CHeighlund

Programmer
Jun 11, 2007
163
US
I've been requested to work on a program designed for use with a set of handheld barcode scanners. As part of this, the end user has requested that I look into finding a way to use the system USB ports as an interface instead of the Comm ports that the scanners currently use. On the hardware side this isn't a problem, as I have seen several adaptor variants for Comm -> USB setups. The problem lies on the software side.

The program I am working with calls another program, which to the best of my knowledge and ability to investigate came with the original scanners. It expects a Comm port value to be passed to it in the command line (or it will use the value stored in an associated .ini file if no commandline port parameter).

I may be misthinking or overthinking this, but I am unsure how to get the scanner program to recognize the USB slot being used for input as a Comm port. If someone has any advice regarding a good place to start looking into this, I would be grateful.
 
CHeighlund,

I worked for a high school that had this basic setup in their library. If I remember correctly, we originally were going to try your method, of buying the adapters and using them, but for some reason or another we decided against it. I can't remember if we tested it and found like you feared, the scanner wouldn't read correctly when plugged into the USB port, but we eventually decided to just buy the newer version of the scanners which came with USB connections. They weren't very expensive and are very easy to implement. They look and function exactly the same, they simply use the USB instead of COM or PS2 connection.

Could you tell me the model and company that makes this scanner? Most often you can find out from them either by phone or on their website about possible driver updates or whether or not the scanner is compatible with USB.

Let me know what you find out,
-surgeVel
 
I've been using Tripp-Lite's USB to Serial Adapter. It includes it's own software setup. Once the adapter has been set up, Windows sees it as a serial port. I've programmed several programs to set up the port as if they were real serial ports.

I suspect that there are other USB to Serial adapters that have their own software setup that do the same thing.



James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
I'll second 2ffat's comment. I worked with a similar setup and, if you install the driver for the USB/Serial adapter, it looks like another comm port to the system. I think if you search the VB6 forum, there's a code sample that will enumerate the comm ports for you, and that works.
 
You might also look at Quatech's line of Serial -> USB adapters. We make enxtensive use of them on a manufacturing floor and find them to be robust and reliable. They require only a WinXP driver that comes with the adapter. They come in 2,4,8,16 & 32 comm port versions.
 
<side question>
Avanderlaan,
[tab]How does the computer track the com ports if you use the 32 port version, i.e. COM 7, COM 8, etc.? Also, do you detect any slow-down on the devices connected on the larger port versions?



James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Comm ports are enumerated sequentially in the registry hive HLKM\HARDWARE\DEVICEMAP\SERIALCOMM. The new Quatech devices are USB 2.0

We find performance limitations are related more to the computer controlling the serial devices and the threading model of the communications software used. Be aware, if you plan to use a "comm control" like MSCOMM32.ocx that the software is artificially limited to 20 or so comm ports. So, to take advantage of "virtual" comm ports provided by the 32 port model you will have to address them by their real names ("\\.\COM#") and use file system commands.
 
Aha! Thanks.



James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Thanks for the information, everyone.

Update on current situation:

I'm still not completely sure what's going to end up happening, but our end users are sending down one of their adaptors and one of the devices that the adaptors are needed for, so hopefully I'll be able to get a better idea of what they can do (and how they're seen) when that happens.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top