LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB to 232 Converter Question

Hello
 
I an working on a project that will use LV to send a string to a 8051 MCU.  Prior to my knowledge of the NI USB-232 device that already has a driver written I spec'ed a radio shack USB to 232 cable.  I selected that cable because I have used it in the past and it alwasys seemed to work without a problem.
 
BUT (isn't there always a but)  I noticed that sometimes when the cable is plugged into the PC it does not always get configured as the same com port. 
 
My question is this:  If I am not sure which com port will be created when the USB to 232 cable is plugged into the PC how can I get LV to find the correct com port so it can send the sting to the MCU?
 
Best Regards
Tim C.
1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 1 of 3
(2,777 Views)
One way is to create a small loop at the beginning of your program to send a command to the MCU (usually a Status command, but any command where you expect to receive data from the MCU should work.) Start with the expected COMM port. If the command request generates a timeout error, then select the next COMM port and try again. Its basically a "Search for Device" loop.

Another way is to create a button called "Check COMM Port" or something similar, where the user can select any one of the available serial ports and test for the MCU.

The autmatic loop can take a lot longer if your system has many COMM ports to cycle thru, where as the manual test would return a result faster, but the user would have to try it multiple times.

Good luck!

Robot wink
0 Kudos
Message 2 of 3
(2,757 Views)
I know that I am replying to an old thread, but I thought I would fill in some information for anyone else who happens upon this. Windows utilizes the product serial number in order to uniquely identify USB devices on the system. If there is no serial number (which is optional for USB devices), the device is identified by the USB port to which it is connected.

Many "electronics store" USB to serial converters (and even some more expensive ones) do not provide serial numbers, so Windows has no way to recognize when the same hardware is plugged into a different USB port. This means that any time you switch USB ports, you are likely to receive a new port number.

You will probably always receive the same port number as long as you are careful to always use the same USB port.

This should not be a problem with any product which supplies a unique serial number to Windows, although this is dependent on the individual driver implementation. Unfortunately is is virtually impossible to tell without buying a product whether it will identify itself in this way. All NI USB-232 and USB-485 products identify themselves uniquely to the operating system, and we take care to ensure that you will always receive the same port number, even when switching USB ports.

-Jason S.
National Instruments
Message 3 of 3
(2,617 Views)