VB control USB to RS232 converter

C

Thread Starter

Charmaine

I have used a RS232 to USB converter in my project, can anyone tell me how to write a program in VB to collect data from the converter?

The computer is using USB port and data from the MCU (RS232).
Please help me to solve this problem. Thank you so much.
my e-mail: [email protected]
 
hi,

your program needs to communicate with this virtual comport. Do a Google search on 'MSCOMM' and 'VB'. You will find what you need.

Da fripster
 
R

Robert Scott

If the system is Windows-based, then the USB-serial converter automatically provides for a virtual serial port that can be treated by your software as an ordinary legacy serial port. Just use the high-level system interface and don't try to peek and poke values into registers that aren't there. Find out from the Device Manager what the COMx name is (COM3, COM4?) of the USB-Serial device, and then reference that COM port number in your software just as if you were referencing a real COM port. The baud rate is irrelevant.

Robert Scott
Real-Time Specialties
Ypsilanti, Michigan
Embedded Systems Consulting
 
S

Stephen Wreford - www.integrated.ch

When you installed the USB Converter hardware a 'normal' communications port would have been specified [com2, com3 etc.]. Once you know which com port is being assigned to the converter, you can treat it as you would any other in VB.

regards
Stephen
 
P
i have tried to use usb to rs232 converter and found
that even after checking the com port number that they
don't work well. Not to despair, another slightly more
complicated usb to rs232 converter comes with other
devices such as extra usb ports, mini din ports, 1 sr232
port, even a fire wire port. now its cost was more than
twice than the simple usb converter but it worked. it
installed the same with software and was called a
porlithic com port or it sold as a LAN dock device. it
comes with its own power supply but will do many more
types of work.
 
Go get Jan Axelson's book:
USB Complete: Everything You Need to Develop Custom USB Peripherals
ISBN 1931448027A

The current edition is the 2005 edition. There are earlier 1999 and 2001 editions.
 
Hi Robert Scott,

could you explain to me how is that about use the high-level system interface?

My problem is I used the same program for the serial port and it works but with the converter usb-serial doesn't
 
M

Martha Gabriela

Hi Charmaine,

I have the same problem with the USB-serial converter.
My app works OK with all the serial ports, but when I used the converter, the data sent is wrong
Have you resolved your problem?
Could you explain to me how?
Thanks a lot.
My e-mail is [email protected]
 
S

stephen wreford - www.integrated.ch

Hi all,
If you wrote a successful application for a standard serial port then the 'principles' are that it should run with a virtual port via USB. Of course text books and reality aint always the same.

What I have found with a few applications is that the timing paramters used may need adjusting to suit the new com port.

I try to write our applications with variables defined for the loop/character and timeout values. This way I can alter the settings in a compiled and running app.

hope this helps.
Stephen.
 
I'm facing the same problem where my app works on serial port but fail at virtual comport. Can you give the brand of the rs232 converter?
 
Hi
Your program should talk to Serial Port. Writing Serial reception can be done using MSCOMM. The data should be in that format what serial Port supports.You concentrate on USB data transmission ie the format. after getting this you can contact me.
 
M
Hi
I have a small VB5 application which uses the parity bit as the start of message. The application works correctly when I use real hardware serial port, but when I try to use an FTDI USB>RS232 adaptor the port does not signal the parity Fail/Change so the messages fail. This is because the adaptor does not by default sense the parity and needs to be told specifically via Win32 API to notify me of the change. Since I'm using VB5 MSComm I will have to rewrite the application in C++ just to do this. VB hasn't got sufficient control in its MSComm control.
 
I have an application where I have to get the Weight from a scale connected to thru RS232. Not able to get data. If u have any sample code can u pls send it...

Regds
Mohan
 
Is it the same if the system is a Mas OS X??
Because I'm trying to sending and receive data to a device via a USB to Serail Converter, and I've no answer from the device. So I don't know if it is receiving the packets well? I'm using a script that worked with a normal Serial Port.

Emilien
[email protected]
 
We also have found problems with USB to RS-232. Our program works correctly with standard serial cables. However when we moved to support new laptops, which didn't have serial/RS-232 ports, issues occurred.

FTDI chips where found to cause problems, probably related to the Parity character??? mentioned previously.

Silicone Labs chips (CP2102) were found to perform correctly. Unfortunately we couldn't find a supplier with a commercial solution (ie in a nice box/case), so we have begun producing our own.

Anybody else want some? :)

Do wish I knew more though... several hours of port snooping blah blah blah and couldn't find another solution which would still be compatible with product in the field!
 
K

k.Partha saradhi

I'm doing a project on "Power Quality Analyzer". I have converted the supply voltages into digital quantitites and then stored in RAM and then serially sent to RS-232 port. All these tasks are done by microcontroller. Now I have to get the data in VB. What i have to do to collect the data? Can Anyone give the source code for this application? Also plz give me ur email id, so that i can contact u.
 
We still have problems with some USB to RS-32 converters. In particular, I have tested 3 brands so far:
1) Radio Shack single port: always works OK for me;

2) FTDI single port, with the Prolific chipset: Did NOT work at first, but did after removing and inserting several times, and the COM port numbers always came up the same when removed and reinserted.

3) ByteRunner PL-8COM (box says MG-UX38, uses the Prolific chipset) 8-port device: This works OK with HyperTerminal, but not with our own application (which calls CreateFile()). Also, when I unplug and reinsert the USB cable, it makes me reinstall the device driver 9 times again (one for the bridge, 8 times for the ports).
Not only that, but the COM port numbers creep up each time, as though you had a bunch of these boxes all connected up.

We need USB to 4 RS232 devices, which don't have to be in an external case. Do you have those, or can you tell me who does with the Silicone Labs CP2102 chips?
 
Whenever you use such a converter, It gets configured between COM3 to COM6. Exact port can be verified from Device Manager. Under Ports option, it shows you how many ports are configured. Then in VB, you can use MSComm1.CommPort = 3 if it is configured as COM3. Rest everything is same.

Good Luck,
Milind
 
Top