Results 1 to 12 of 12

Thread: [RESOLVED] I need some pointers....USB related...

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    6

    Resolved [RESOLVED] I need some pointers....USB related...

    Hi

    I have several years of programming experience, though little contact with VB itself. I have been asked by an acquaintance to research the feasibility of a project.

    He is designing an electronic product which he would like to connect via USB to a PC. The connection is only designed to send packets of information between the two. The device will receive instructions from the PC which it will then process and act upon. The PC will receive results back from the device and then carry out some actions - eg populate a database, refresh the screen, generate weblinks based on some rules etc.

    I'm in the very early stages of investigating this. What I would like to know is:

    1. Is VB a good choice for communicating through USB? Can it be done?

    2. Assuming it is, what options are there for doing this? Does VB have built-in functionality? Is it platform dependent? May it involve creating drivers?

    3. What particular avenues do you recommend that I read up and learn more about?


    I appreciate any advice, and thank you in advance.

    Regards

    Rich

  2. #2
    Fanatic Member sessi4ml's Avatar
    Join Date
    Nov 2006
    Location
    Near San Francisco
    Posts
    958

    Re: I need some pointers....USB related...

    Welcome, with my USB memory stick , my Vb6 assesses a security file and the program continues to run. There are other devices such as parallel devices. These are more long term, meaning, they never move, unlike USB tied around my neck (on my key chain). Since VB6 is going away, either VB Net or ? RealBasic.com looks interesting, PC, MAC, Linux...Helpful ?

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    6

    Re: I need some pointers....USB related...

    Quote Originally Posted by sessi4ml
    Helpful?
    Yes, in the sense that you haven't told me I'm barking up the wrong tree and to go get my head checked.

    With regard to your USB Memory stick, I'm guessing that your VB6 program looks for the file on a "Removable Storage Device". If that's the case, then I'm not sure that will be usable for our project. What we're after would be some way of controlling a device which is connected by USB. For example, printers connect this way, or I've seen a USB controlled toy missile launcher !!! Missile Launcher

    I suspect that we'll be concentrating on Windows installations but it would certainly be interesting if we could get a cross-platform solution.

  4. #4
    Fanatic Member sessi4ml's Avatar
    Join Date
    Nov 2006
    Location
    Near San Francisco
    Posts
    958

    Re: I need some pointers....USB related...

    Controlling a device X10.com
    Some cool devices here; I have some.

    If you want to control something, think about a Parallel port and sending bits..used as toggle switches...you will need some TTL logic.
    I have played with a Stamp Computer to control ?
    http://www.robotstore.com/store/prod...150&catid=1628
    Better directionl?

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    6

    Re: I need some pointers....USB related...

    I'm not sure I can make any sense of what you posted.

    X10.com seems to be a retailer of various bits of kit that can be controlled from a PC. They also sell software to assist with this.

    What we're trying to do is something that hasn't been done yet (I believe), so the devices don't exist and neither does the software.

    However, there are distinct similarities between our plans and the USB Missile Launcher. Siply put, you plug the launcher into a USB port and use some Windows-based software to aim and fire it in real time.

    We want to connect our device via USB and use Windows-based software to control it - although it won't be a motorised device it will be an electronic unit that reads data from another electronic device and then passes that data back to the PC.

    I believe this is possible with VB - because someone claims to have reverse-engineered the Missile Launcher software into VB.

    So, does anyone know if this launcher (or similar devices) uses any special electronic components in order to communicate over the USB? If so, what do I need to look for? If not, how is it achieved and where can I read up more?

    Thanks

  6. #6
    Fanatic Member sessi4ml's Avatar
    Join Date
    Nov 2006
    Location
    Near San Francisco
    Posts
    958

    Re: I need some pointers....USB related...

    Thanks for the picture, USB is like RS232, meaning the data is in tandem, one bit followed by the next bit. Four wires (pins) : Power, Ground, and two pins for sending/receiving data.
    You will need to decode the USB into Binary so you could access to the all eight bits. I am sure there is a chip that will do this, but you will need to create the support logic (TTL) Once you have this, your code could send a Ctrl A (0000 0001) and your device will ? move ?
    Is this it?

  7. #7

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    6

    Re: I need some pointers....USB related...

    Sounds like it could be useful. I must emphasise that I will be working on the PC end of this contraption, whilst my acquaintance will be developing the device hardware. He does electronics for a living and is a well-respected designer. However, he doesn't touch PC software so he wants to pass the buck to somebody else.......me.

    Simply put, I will tell him what can be done. He will work out what his device needs and will then instruct me on how he wants communication to work. I suspect he will be creating a chip himself to deal with the USB connection and he will be aware of the way that USB handles things.

    So, my query is really relating to how VB can talk through USB. Let's say we have this device connected when we power up. Windows sees it and registers what it is and which port it is connected to. We fire up our software to control the device. The software will find out which port the device is connected to, or perhaps we need a driver or something for that. How do you tell VB to transmit a packet of data via a USB port?

    Thanks for your help thus far.....

  8. #8
    Fanatic Member sessi4ml's Avatar
    Join Date
    Nov 2006
    Location
    Near San Francisco
    Posts
    958

    Re: I need some pointers....USB related...

    This is the part I can not help you with. We both know about plug and play...sort of.
    A USB device is pluged in and the system sees it and trys to find and load its driver.
    Maybe try : http://www.ingenio.com.
    As for the VB part, the interface driver probably C,
    After that, either you send commands or both send and receive.
    If you think of another question, ask, otherwise mark this thread as resolved

  9. #9
    Fanatic Member sessi4ml's Avatar
    Join Date
    Nov 2006
    Location
    Near San Francisco
    Posts
    958

    Re: [RESOLVED] I need some pointers....USB related...

    USB..
    Visual Basic Programmer's Guide to Serial Communications
    http://search.barnesandnoble.com/boo...sbn=1890422274
    This may help

  10. #10

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    6

    Re: [RESOLVED] I need some pointers....USB related...

    Thanks for that. I think that's going to be an extremely useful book. I just hope I can find one here in the UK at a sensible price.

  11. #11
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: [RESOLVED] I need some pointers....USB related...

    Or just look in the VB help file for the MSComm control. There are examples of code for receiving and sending data. (Look under both MSComm Control - Example and OnComm Event - Example.) All you'll need is the port number (see below).

    The device itself will need a driver, regardless of the language you write the code in. If he's buying a USB chip, the chip manufacturer will have drivers available. If he's creating the USB interface on his own he'll have to write the driver himself, or design the interface to be close enough to some existing chip that the available driver will work. (It's a LOT cheaper to buy an interface chip if one's labor is worth even the US minimum wage.)

    The driver will install itself as a virtual serial port (all hardware is virtualized in NT and its derivatives, like XP) with a COM number - look in Device Manager, under Ports (COM & LPT) to see what port number Windows assigned it. The virtual port assignment will only be in existence as long as the device is connected to the computer. (The port number can be changed manually. If you successively plug the device into all available USB ports and manually change the port number to the same number for each spigot [use the first spigot's number for the rest of them], the device will retain that port number regardless of the spigot it gets plugged into [on that particular computer].)
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  12. #12

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    6

    Re: [RESOLVED] I need some pointers....USB related...

    That sounds very useful indeed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width