PIC Serial USB & PC Comports

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Gypo
Posts: 52
Joined: Thu Apr 29, 2010 11:12 am
Has thanked: 5 times
Been thanked: 3 times

PIC Serial USB & PC Comports

Post by Gypo »

Hi

If I can a couple of questions in one but both very related (for me anyway).

I have with the help of you guys got my pic18F2550's talking to a PC over USB (serial USB configuration), it works great with the following exceptions that I hope someone can help me out...

The when I send serial data over USB to the PC from the PICs it is at 9600 baud, is there any way of making this faster? say 19200?

And when the pics are connected to the USB ports of my PC they come up at com 10 and above, a lot of the times it is over com 16 and that is causing me problems. I am using Visual Basic 6 pro to write the PC side of things and that can only talk to com ports up to com 16, anything above that it doesn't want to know.

I have heard that if a USB serial device is given a serial number it will show up on any PC it is plugged into on the same com port every time, any idea how I do that? Is it in the driver or the software on the pic? Or.... any help on making VB6 talk to com ports above 16?? I have searched all day looking for a fix but have only found VB6 extras that want to charge me in excess of £50

So... some help in the pic side of things would be very much appreciated.

Regards
Last edited by Gypo on Sat Sep 04, 2010 5:51 pm, edited 1 time in total.
The only real simulation isn't ...
Gypo

Gypo
Posts: 52
Joined: Thu Apr 29, 2010 11:12 am
Has thanked: 5 times
Been thanked: 3 times

Re: PIC Serial USB & PC Comports

Post by Gypo »

Hi again guys

This is what I got from Microchip a while ago
****
A USB CDC device provided with a serial number string descriptor prevents unwanted "COM port proliferation",
meaning that it retains its COM port number if it is moved to a different USB port on a Windows® PC.
A USB CDC device that doesn‘t contain a serial number gets a new port number on each attachment to a
different port on a PC.
******

Not how I remember it as it suggests it only keeps the com port the same on the same PC.

Anyway if anyone could help!!!

Thanks
The only real simulation isn't ...
Gypo

Gypo
Posts: 52
Joined: Thu Apr 29, 2010 11:12 am
Has thanked: 5 times
Been thanked: 3 times

Re: PIC Serial USB & PC Comports

Post by Gypo »

Update....

On the net there is a hack that seems to have worked with the VB6 problem in not being able to see any ports above com 16 and that is to edit the MSCOMM32.OCX in C:\WINDOWS\system32.

Use a hex editor and look for the following unique three bytes sequence in the OCX: 3D 10 00
The middle hex byte, 10, represents the upper port limit. You can change this to something you like better; 99 would be 63.

I have changed it to FF so that any up to 255 will be OK. VB will now let me open and read/write data through the port.

If anyone could help with the speed that flowcode uses through a serial USB port it would be appreciated.

Thanks
The only real simulation isn't ...
Gypo

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: PIC Serial USB & PC Comports

Post by medelec35 »

Hello Gypo.
With your USB connect to your PC (as com port disappears if USB232 is disconnected), go into device manager, then look at ports (COM and LPT), click on arrow to expand. The USB should of created a VCP (virtual com port) and assigned a com number. Right click on the assigned com channel and select properties. Click on the port settings tab. You can then change the baud rate etc. Don't for get to also change the baud rates of anything connected e.g hyperterminal and 232 module within flowcode. There will be an upper limit that will be 100% reliable, too higher settings will cause errors! Also on the port settings tab, you will see Advanced. If you click on that, you would also be able to re-assign the UYSB device to a different com port. Be careful you don't assign the com port with something else already connected to com port, as there will be conflicts.
Hope this helps.
Martin

Gypo
Posts: 52
Joined: Thu Apr 29, 2010 11:12 am
Has thanked: 5 times
Been thanked: 3 times

Re: PIC Serial USB & PC Comports

Post by Gypo »

Hi medelec35

Thanks for your reply. The PC side of things I have got covered as I am controlling the port from visual basic and so I can have it do prety much as I want. The main thing was having the serial usb going at the right rate for the settings I give the PCs com port (virtual com port).

I have since posting had the com port running at all sorts of speeds without having to change anything in Flowcode, so it appears that once the USB serial is set up in Flowcode you can use almost any baud rate on the PC side and it will still work.

Anyway, the speed I need to use is doing fine.

Thanks again
Gypo
The only real simulation isn't ...
Gypo

Post Reply