Answered Visual Basic USB control

  • Thursday, January 24, 2008 5:40 PM
     
     

    Hi,

    I am trying to send and receive data through a USB port on my computer to an external microcontroller.

    I built most of the code using the "serial class" but then i read that this would not work with a USB port.

    How would I go about communicating with this USB port on my computer?

    Thanks.

All Replies

  • Tuesday, January 29, 2008 6:21 AM
     
     Answered

    rox1631,

     

    Based on your post, you would like to send/receive data through USB port with the external device. I would like to provide you the suggestions as follows:

     

    1. Port Operations in the .NET Framework with Visual Basic

     

    You can access your computer's serial ports through the .NET Framework classes in the System.IO.Ports namespace. The most important class, SerialPort, provides a framework for synchronous and event-driven I/O, access to pin and break states, and access to serial driver properties. It can be wrapped in a Stream object, accessible through the BaseStream property. Wrapping SerialPort in a Stream object allows the serial port to be accessed by classes that use streams. The namespace includes enumerations that simplify the control of serial ports.

     

    2. In VB 2005, you can try to use SerialPort class that provides synchronous and event-driven I/O, access to pin and break states, and access to serial driver properties. Furthermore, I would like to provide you two examples on the issue:

     

    Visual Basic .NET Code Sample: Using the COM Port in VB.NET

     

    Programming Serial Ports Using Visual Basic 2005

     

    2. If it is necessary, please download the USB library for .NET. usblib (SharpUSBLib) is a wrapper around the libusb project (WIN32), thus you must have it installed prior to using #usblib. Mike started this project because he wanted to program a power switch (GEMBIRD SIS-PM) with a USB port and didn't find any .NET USB library. One goal is to provide a platform independent (Linux/Win32 solution) USB access layer for .NET.

     

    http://www.icsharpcode.net/OpenSource/SharpUSBLib/ 

     

    3. This question is common and there are many threads on the topic. Please take a look at the following threads that can also provide you some idea:

     

    Sending information to a USB port

     

    detecting USB drive from windows apps 

     

    Hope that can help you.

  • Wednesday, January 30, 2008 12:02 AM
     
     

    thank you so much! im using VB 2005 and this solves my problem

  • Sunday, March 01, 2009 7:53 PM
     
     
    well i don't know what's i can say about you but thank you so os much
    ayman
    Simply Powered By: Submarin64x
  • Tuesday, November 10, 2009 8:36 AM
     
     

    Can i know how you solve ur problem..
    i have same problem with you.
    i want to get some data using USB from my device.
    would you like to share your experience here.
    Thank you.

  • Tuesday, November 10, 2009 8:39 AM
     
     

    Do you really think he is still watching this forum after getting his answer at march 01?

    Simply create a new question.

    It is not in my part but guys like Dick Grier probably for sure want to help you when they see your question.


    Success
    Cor
  • Thursday, January 17, 2013 3:56 AM
     
     
    Hi Bruno. All links related with Microsoft were removed. :(