Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Serial communication using AVR and VB6 with USB to serial converter

Status
Not open for further replies.

ark5230

Advanced Member level 3
Joined
Jun 29, 2009
Messages
862
Helped
163
Reputation
324
Reaction score
140
Trophy points
1,323
Location
India
Activity points
6,187
I am USB to serial converter for serial communication with AVR microcontroller.
The computer side program is in VB6. VB6 allows only fewer serial ports like com1, com2 etc.
When I connect USB to serial converter, it connects to Port 11 on one laptop and com 20 on the other.
Now the question is that from control panel or device manager of the windows can I shift this USB to serial converter to something like com1 or com4.
Is there any way to force connect the USB to serial converter to a desired com port!
 

Yes, it can be done..

First you have to remove the com port you want to use (if it is used by some others like bluetooth).

Then you can move your device to desired number.
 
When I connect USB to serial converter, it connects to Port 11 on one laptop and com 20 on the other.
Now the question is that from control panel or device manager of the windows can I shift this USB to serial converter to something like com1 or com4.
Is there any way to force connect the USB to serial converter to a desired com port!

What specific USB to UART bridge device is utilized by your USB to Serial Converter?

Not all the features discussed below maybe applicable to your device and its driver.

Typically both the windows device driver and its setup information file (INF) of the USB to UART bridge device dictate the allocation of the virtual communication port (VCP) number as well as many other parameters.

The driver of FTDI FT232R, a common USB to UART bridge device, references its INF file during installation and sets the default first allowable COM port number, typically COM3, under the InitialIndex parameter contained in the Windows Register. When such a device is first plugged into a port the driver starts the search for the first available COM port number at the value contained in the InitialIndex parameter, if COM3, for example, is already allocated the value is incremented and checked for availability and allocated if not already in use.

Once a COM port has been allocated to a particular device the VID, PID and serial or ID number are stored in the registry for future reference.

For Example:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\FTDIBUS\VID_VID+PID_PID+Serial_Number\0000\DeviceParameters\PortName



Location of other related parameters:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\FTSER2K


You can change the COM port number assignments manually through the Device Manager => Ports (COM & LPT) => Specific Device => Port Settings => Advanced

Example Standard COM port settings:


FTDI FT232R COM port settings:


How COM Ports Are Allocated On Driver Installation

Also as nandhu015 suggested it is possible to develop a Windows or Control Panel application which modifies these registry settings directly.

However, I would caution you against developing such an application using your primary Windows system as the such code development is nontrivial and may have a significant negative impact on the registry and function of your system.

The attached application provides an example source code and compiled application to be ran in a "DOS" windows which scan the registry and displays all COM port allocations.


BigDog
 

Attachments

  • Readreg.zip
    14.7 KB · Views: 63
Thanks a lot Big Guru and Nandhu for your valuable guidance that helped me resolve the issue.
One point I misunderstood regarding VB that it allows lower values only, it was due to other issues, VB6 does allow higher serial ports as well. The information here is really useful and I badly needed this.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top