发表于:2007-04-05 17:34:00
3楼
我今天在一个国外的自动化论坛上看到这样一个帖子:
谈到的是USB到RS-232这样转换器痛苦的使用经历:这个用户换了6个品牌的USB-RS232的转换器,最后此人想到了USB-USB的方式。
我从一个厂商的角度,想听听大家对这种廉价的USB-RS232转换电缆的应用经历、经验以及看法。这样的转换电缆好像只有30-40多元?
当然我们的转换器,要比这个贵的很多了。
原贴如下:供各位参考:
******************************************************
USB PC to PC communication in Visual Basic
Mar 2, 2007 11:47 pm, by Bert
Subject : Networking
from the Automation List dept.
Text :
Hello All,
A while ago, I developed a system in which two specialized applications written in VB6 running on two different computers needed to exchange data in real time via a serial interface (std RS232 COM port). One of the two computers is a laptop which one operator connects regularly to a host computer and reads data and sends data as well. Today's computers do not have COM ports anymore. We have used USB to Serial adapters and it does not work so well anymore. It seems that these adaptors tend to jam the communication from time to time, which never happenned before. We have tried 6 different brands with no success. We would like to get rid of these adapters and modify our code in both applications so that the computers could communicate with a direct USB to USB link.
In the original software, the communication part was written using MSCOMM32.OCX. I have not found anything equivalent for USB communication.
Any suggestion anybody?
Reply
--------------------------------------------------------------------------------
Re: USB PC to PC communication in Visual Basic
Apr 2, 2007 11:55 pm, by saurabh A Dixit
Yes friend,
For same thing I was searching. Now I come to know that it's not possible using MSCOMM.OCX to comunicate for USB. It's only for RS232. So if you got anything for USB communication from PC to PC using VB, C++ or anything else.
Reply
Re: USB PC to PC communication in Visual Basic
Mar 30, 2007 11:50 pm, by Anonymous
You have to be carefull to connect two computers with a USB cable! You should use a USB-USB bridge cable (http://www.manhattan-support.com/driver-usb-datatransfer.shtml). With this type of cable you will create a network between the two computers. You can share data, map drives... In VB you could consider using winsock to send and/or receive data.
Read also http://www.hardwaresecrets.com/article/248
Reply
Re: USB PC to PC communication in Visual Basic
Mar 10, 2007 7:01 pm, by Steve Hill
I'd suggest forgetting about using USB, and simply use an IP Socket communication and have the machines connected via Ethernet.
It's a lot easier to do than USB or serial, and there's a lot of example code around.
-Steve
Reply
Re: USB PC to PC communication in Visual Basic
Mar 27, 2007 12:33 pm, by Anonymous
I need to convert RS-232 interface to USB to connect to a Pocket PC. I have hardware that supports only RS-232, and it has to work on my PC and a Pocket PC. Pocket PC supports only USB. Any shareware library available? Or suggestions on how to proceed is appreciated.
Reply
Re: USB PC to PC communication in Visual Basic
Mar 4, 2007 6:56 pm, by Michael Batchelor
I think you fail to understand how USB works. The Computer has a "USB Controller" that acts like a bus master. You cannot connect two USB bus
masters to the same peripheral bus. It just doesn't work that way.
USB might be serial data, but it isn't exactly like an RS-232 port where the two computers are "peers". Think about it as if you were trying to hook two computers together through two SCSI controllers. It just "won't work" they
way you want it to.
What you can do is use two usb-ethernet adapters and change the communications to use Ethernet, but in that case why mess with the usb. Just use two NIC cards.
Michael
--
Michael R. Batchelor
www.ind-info.com
GUERRILLA MAINTENANCE [TM] PLC Training
5 Day Hands on PLC Boot Camp for Allen Bradley
PLC-5, SLC-500, and ControlLogix
www.ind-info.com/schedule.html
training@ind-info.com
Industrial Informatics, Inc.
1013 Bankton Cir., Suite C
Hanahan, SC 29406
843-329-0342 x111 Voice
843-412-2692 Cell
843-329-0343 FAX
Reply
Re: USB PC to PC communication in Visual Basic
Mar 6, 2007 10:34 pm, by Nathan Boeger
Mike,
How does a device like this work? I know there are USB cables that allow data transfer between pcs - I have no idea how you would interface with it in VB 6 or .NET. Any ideas?
http://shopper.cnet.com/6FT_USB_TO_USB_FILE_TRANSFER_CABLE/4014-3115_9-1781577.html
----
Nathan Boeger
Inductive Automation
Total SCADA Freedom
Reply
Re: USB PC to PC communication in Visual Basic
Mar 9, 2007 12:38 am, by Michael Griffin
In reply to Nathan Boeger: It's not just a cable. It has a "magic box" in the middle. I believe that these devices use a shared memory buffer in the middle which both USB masters read and write (similar in principle to the boxes used to let Profibus DP masters talk to each other).
A number of companies sell these cables, and I suspect that each uses a different proprietary protocol. You need to have proprietary software (part of the product) running at each end in order to use it. In the "old days", you used to do things like this with serial or parallel cables.
Unless someone has reverse engineered the protocol, I don't think much can be done with these cables.
Reply
Re: USB PC to PC communication in Visual Basic
Mar 9, 2007 12:32 am, by Michael Batchelor
That's a good question! I don't think I've ever seen one of these, and if I have, I know that I didn't realize what it was.
But you can bet that I'm going to figure it out now.
Maybe the answer is that *I AM* the one who fails to understand how USB works. Nothing like exposing yourself in public!!!
MB
Reply
Re: USB PC to PC communication in Visual Basic
Mar 3, 2007 3:04 pm, by William Sturm
You don't say which compiler or language that you are planning to use. Based on the fact that you were using VB6, it is a safe bet that you are considering VB.Net
It is difficult in .NET also to send ascii data between two computers. With Ethernet on must learn remoting or web services, what happened to a simple socket interface. USB is probably even harder.
My suggestion is to buy PCI RS-232 cards and use a serial library. It is old school, but it still works well and is relatively simple. Microsoft recently added serial communication support to .NET, maybe serial is not so dead after all.
I needed to do this this last year and just got fed up and used VB6 and MSComm.
Bill
Reply
Re: USB PC to PC communication in Visual Basic
Mar 28, 2007 11:38 pm, by Gargantua
Don't be stupid, man, IT IS NOT POSSIBLE, thus you need to design a driver to indicate which kind of device is conected to the PC. With the driver you can make the connection between two computers OK!!!
BEST REGARDS!!! AND I HOPE HAPPY DESIGN OF THE DRIVER, YOU KNOW HOW TO PROGRAM IN ASM?
Reply