For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > March 2004 > Re: USB COMMUNICATION









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: USB COMMUNICATION
J French

2004-03-29, 10:30 am

On Mon, 29 Mar 2004 00:06:07 -0800, =?Utf-8?B?Q01TVFZN?=
<cmstvm@vsnl.com> wrote:

>We are developing applications in vb6.0 platform and using mscomm control for communicating through COM ports.
>But now we need to communicate through USB port from VB6.0 application. Pls advise us how this can be acheived using Windows XP and VB 6.0


Well I do it just like a normal COM port

USB stands for Universal Serial Bus
- you can ignore the 'U' and the 'S'

It is just the 'B' that matters
- and if the thing on the Bus looks like an RS232 and quacks like an
RS232 then it should pretend to be an RS232


Dick Grier

2004-03-29, 12:30 pm

Hi,

You use whatever API is provided by the USB device manufacturer. If this is
a USB serial adapter, then you can continue to use MSComm.

If you have a purpose-build USB device, then I suggest that you get a copy
of Jan Axelson's book, USB Complete, 2nd Edition. I have a link to it under
Books on my homepage. It have VB examples.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.


Biju S Nair

2004-03-30, 2:30 am


Hello
Thank You for sending reply.

Could u give me more details about how we can configure MSCOMM control
in VB6.0 for USB Ports.

Comport Settings

I/O Range - 02F8-02FF
IRQ - 3

USB Settings

I/O Range - E7000000-E7000FFF
IRQ - 20
Rerards
Biju S
Development Engineer
cmstvm@vsnl.com


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
J French

2004-03-30, 3:30 am

On Mon, 29 Mar 2004 22:06:42 -0800, Biju S Nair <cmstvm@vsnl.com>
wrote:

>
>Hello
>Thank You for sending reply.
>
>Could u give me more details about how we can configure MSCOMM control
>in VB6.0 for USB Ports.


I've programmed for an RS232 device hanging off a USB, and did not
have to worry about such low level stuff.

You put a USB to Serial converter at the other end of the USB and it
will be recognied by /Windows/ as a standard RS232

It will have a higher COM number - which you will have to identify

From then on you can just use the MSCOMM control as you would a normal
RS232 - or if you want to, use CreateFile

Sadly the days of rooting around at port and IRQ level are long past
- to do that one has to write a Windows Device Driver
- and that is not a subject for a VB NG

The good news for you is that, from my experience, RS232 over USB is
very easy to implement - and IME is reliable.

Just to clarify things, think of USB as a Bus
- like the one running on the motherboard of your PC
the thing that is exposed to the outside world by slots
- into which you plug an RS232 or Parallel or SCSI card

When you plug an RS232 USB convertor (which is little more than a
smart plug) into a USB slot,
- you are doing just the same as pushing an RS232 Card into an ISA
slot.
Dick Grier

2004-03-30, 11:30 am

Xref: kermit microsoft.public.vb.general.discussion:438078

Use MSComm. Set the CommPort property to that supplied by the USB port.
The IO port addresses used by internal (hardware) serial ports have nothing
to do with the ports use by the USB adapter, which uses a software driver to
emulate a serial port.

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com