Author |
Message |
Bee #1 / 19
|
 Serial VS USB
My VB6 app looks at ports using the MSCOMM (MSCOMM32 ActiveX Control)component. I try to open a port and set parameters. Unfortunately, I do not know how to distinguish a serial port from a USB port. What test can I use to determine if the port is USB or Serial?
|
Mon, 18 Jun 2012 07:41:01 GMT |
|
 |
Jim Mac #2 / 19
|
 Serial VS USB
Quote:
> My VB6 app looks at ports using the MSCOMM (MSCOMM32 ActiveX > Control)component. I try to open a port and set parameters. > Unfortunately, I do not know how to distinguish a serial port from > a USB port. What test can I use to determine if the port is USB or > Serial?
If you can open it with MSCOMM, it's a serial port. It doesn't matter if it's a physical port, a virtual port, or a USB-hosted port. -- Jim Mack Twisted tees at http://www.cafepress.com/2050inc "We sew confusion"
|
Mon, 18 Jun 2012 10:18:53 GMT |
|
 |
CY #3 / 19
|
 Serial VS USB
Quote: > My VB6 app looks at ports using the MSCOMM (MSCOMM32 ActiveX Control)component. > I try to open a port and set parameters. > Unfortunately, I do not know how to distinguish a serial port from a USB port. > What test can I use to determine if the port is USB or Serial?
Unfortnatly I don have any serial or serial USB devices but Number of serial devices might be found at HKEY_LOCAL_MACHINE\SYSTEM \CurrentControlSet\Services\Serial\Enum\Count Do they differ in any way? I use them alike from VB with no problems so far... //CY
|
Mon, 18 Jun 2012 20:01:45 GMT |
|
 |
Bee #4 / 19
|
 Serial VS USB
I need to know if a port is Serial (RS232) or USB or whatever not just a count although a count is useful. THere used to be two serial RS-232 ports on a PC. I need to see if my app will work on the PC or if I need to suggest a USB Serial converter. There may not be any device hooked up so I cannot rely on trying to communicate e.g. see if it respons as a modem (which I already do). There are hardware interfaces that are only serial RS232 that I need to talk to. To me serial has always meant RS-232 as that is the technology I grew up with. Also, does anyone recommend a good USB to Serial RS232 converter? Quote:
> My VB6 app looks at ports using the MSCOMM (MSCOMM32 ActiveX Control)component. > I try to open a port and set parameters. > Unfortunately, I do not know how to distinguish a serial port from a USB port. > What test can I use to determine if the port is USB or Serial?
|
Tue, 19 Jun 2012 00:57:01 GMT |
|
 |
Nobod #5 / 19
|
 Serial VS USB
Quote: >I need to know if a port is Serial (RS232) or USB or whatever not just a > count although a count is useful.
Why do you need to know that? I can't think of any reason to limit a software from using USB-to-Serial converters. For you, they behave the same.
|
Tue, 19 Jun 2012 01:25:21 GMT |
|
 |
DickGrie #6 / 19
|
 Serial VS USB
Hi, You can use WMI to obtain the port description for installed ports. I have code examples for this in my book (below). I also provide a modified version of MSComm32.ocx that allows you to open ports higher than 16, which often happens these days. If you send me email, I will reply with that OCX attached. However... USB serial adapters are used just like any other serial adapter. Do you really need to know whether or not is is USB (virtual serial port) vs. hardware? You just set the CommPort number and Settings, (etc.), and go. In answer to your other question, I tend to prefer USB serial adapters that are based on the FTDI chipset. These seem to be reliable across all OS -- Richard Grier, Consultant, Hard & Software 12962 West Louisiana Avenue Lakewood, CO 80228 303-986-2179 (voice) Homepage: www.hardandsoftware.net Author of Visual Basic Programmer's Guide to Serial Communications, 4th Edition ISBN 1-890422-28-2 (391 pages) published July 2004, Revised July 2006.
|
Tue, 19 Jun 2012 02:07:29 GMT |
|
 |
DanS #7 / 19
|
 Serial VS USB
Quote: > a good USB to Serial RS232 converter?
Isn't that an oxymoron ?!?!?!?!!?
|
Tue, 19 Jun 2012 02:12:56 GMT |
|
 |
Bee #8 / 19
|
 Serial VS USB
Huh? I need to know if a PC has one usable real serial RS232 port or more. If it does not, then I will suggest a USB to serial RS232 converter. If it has a real serial RS232 port I will test it to see if the hardware I expect is attached. Does not the USB to Serial driver look like a serial RS232 port so I can just try it as if it is an RS232 port? Quote:
> >I need to know if a port is Serial (RS232) or USB or whatever not just a > > count although a count is useful. > Why do you need to know that? I can't think of any reason to limit a > software from using USB-to-Serial converters. For you, they behave the same. > .
|
Tue, 19 Jun 2012 05:13:01 GMT |
|
 |
CY #9 / 19
|
 Serial VS USB
Quote: > > a good USB to Serial RS232 converter? > Isn't that an oxymoron ?!?!?!?!!?
Yep, USB is serial... as RS-485, RS-422 (Still handy, like the cable length/multidrop and still async), and the new nice hard drives connect with SATA. Serial isnt all, can be parallel like IEEE-1284 (Centronics port if anyone remember, If my memory dont fail me) and you still can talk to them. For the Q about nr of zerials , look at my earlier post. You have to test it, I cant! (Or, I wont ;) Happy New Year) //CY
|
Tue, 19 Jun 2012 05:22:16 GMT |
|
 |
Bee #10 / 19
|
 Serial VS USB
I have used WMI but do not know how to interpret the data to determine if: (1) true hardware serial RS232 (2) USB port (3) USB port with USB to Serial dongle. (4) other In my case, I see my Sprint dongle showing up in that serial area. But I do not see a generic descriptor. Hope I do not have to sort through millions of different devices to determine what is attached. I need somthing distributable! Suggestions please. And thanks for the tip on the FTDI chipset! That really helps me. For example: (this laptop has no Serial RS232 port) Name Sprint Connection Manager NMEA Port (COM7) Status OK PNP Device ID NMEA\PORTB\1&5&NMEAAPP0 Maximum Input Buffer Size 0 Maximum Output Buffer Size No Settable Baud Rate Yes Settable Data Bits Yes Settable Flow Control Yes Settable Parity Yes Settable Parity Check Yes Settable Stop Bits Yes Settable RLSD Yes Supports RLSD Yes Supports 16 Bit Mode No Supports Special Characters No Baud Rate 9600 Bits/Byte 8 Stop Bits 1 Parity None Busy No Abort Read/Write on Error No Binary Mode Enabled Yes Continue XMit on XOff No CTS Outflow Control No Discard NULL Bytes No DSR Outflow Control 0 DSR Sensitivity 0 DTR Flow Control Type Enable EOF Character 26 Error Replace Character 0 Error Replacement Enabled No Event Character 0 Parity Check Enabled No RTS Flow Control Type Disable XOff Character 19 XOffXMit Threshold 512 XOn Character 17 XOnXMit Threshold 2048 XOnXOff InFlow Control 0 XOnXOff OutFlow Control 0 Driver c:\windows\system32\drivers\pctnullport.sys (2.0.2.0, 37.77 KB (38,680 bytes), 12/2/2009 12:12 PM)
|
Tue, 19 Jun 2012 05:21:01 GMT |
|
 |
CY #11 / 19
|
 Serial VS USB
Quote: > I have used WMI but do not know how to interpret the data to determine if: > (1) true hardware serial RS232 > (2) USB port > (3) USB port with USB to Serial dongle. > (4) other
Yes, but true RS-232 is not all serial comm, but normally all thing that hook up to th before mentioned reg entry (not tested, but thats what I think right now), the electrical interface is not interesting but all noted there should be a serial communication device as you now know them. Nown 00:10 so I can report: its not been so bad this year soo far ;) ohh, here comes some more fireworks gottago...
|
Tue, 19 Jun 2012 07:11:44 GMT |
|
 |
James Hah #12 / 19
|
 Serial VS USB
I would have thought that you needed to know that the PC has one usable serial port, and if it doesn't then you can suggest a USB to serial converter. If it has one usable serial port you don't care whether it is a USB device or an RS232 device or some other port emulator. If you find _any_ serial port then there's no need to suggest that the user install one.
Quote: > Huh? > I need to know if a PC has one usable real serial RS232 port or more. > If it does not, then I will suggest a USB to serial RS232 converter. > If it has a real serial RS232 port I will test it to see if the hardware I > expect is attached. > Does not the USB to Serial driver look like a serial RS232 port so I can > just try it as if it is an RS232 port?
|
Tue, 19 Jun 2012 10:27:12 GMT |
|
 |
Nobod #13 / 19
|
 Serial VS USB
Quote: > Huh? > I need to know if a PC has one usable real serial RS232 port or more. > If it does not, then I will suggest a USB to serial RS232 converter. > If it has a real serial RS232 port I will test it to see if the hardware I > expect is attached. > Does not the USB to Serial driver look like a serial RS232 port so I can > just try it as if it is an RS232 port?
As far as your software is concerned, they are both equally real. Perhaps what you were looking for is finding which COM port exists. Start with port 1, then try to open it and trap any error. You get different errors if the port is in use or if it doesn't exist. Then increment the port number and try again, or simply let the user specify the port to use from a long drop-down list.
|
Tue, 19 Jun 2012 22:14:33 GMT |
|
 |
CY #14 / 19
|
 Serial VS USB
As thinking about this a bit, if a modem (internal) acting like a com port(addr &H358/258 INT 3/4) would be seen as a serial device (with it is) then is it a serial port? *g* //CY
|
Wed, 20 Jun 2012 13:48:12 GMT |
|
 |
CY #15 / 19
|
 Serial VS USB
Quote: > As thinking about this a bit, if a modem (internal) acting like a com > port(addr &H358/258 INT 3/4) would be seen as a serial device (with it > is) then is it a serial port? *g* > //CY
oops 378/278 sorry---
|
Wed, 20 Jun 2012 16:06:14 GMT |
|
|