.NET program talking to microcontroller over USB -- quick how-to

Posted on 2010-01-10
Medium Priority
Last Modified: 2012-05-08
Hello.  I'm tasked with getting a windows app written in VB.NET talking to a micrcontroller.  Our microcontroller has a USB interface and I'm writing code for it in C.  Ultimately we need to connect the microcontroller to a PC with our VB.NET program on it, and get the two talking.

I am very experienced with embedded C and with VB.NET, and have spent lots of time getting the two to talk over a serial port, but I have zero experience writing anything that talks USB.

Can someone please give me a quick how-to on this?  Please, no links, I have plenty of links to get me started on USB concepts -- it's not in focus yet but I'll eventually get there.  I think what I need right now is a 25-50 word, real-world, person-to-person description of what I need to do to send "hello world" from my VB.NET application to my microcontroller over USB.

(When explaining it, your audience is someone who may be hung-up on the simplicity of the RS-232 serial connection -- I think I've been spoiled, and it's impeding my comprehension of USB.)

Thanks *very* much in advance.
Question by:riceman0
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Author Comment

ID: 26278467
Too broad a question?

A few specific questions:

what .NET objects will I end up using on the .NET side to send a message to my connected micro over USB?

I imagine that my micro will have to do a lot of negotiation with windows while establishing a connection, I imagine a lot is handled for me on the PC side, but I will have to do a lot myself on the micro side.  Is this the right idea?

All of the USB documentation seems to start with the multitude of "classes" my micro/device could be (e.g., human interface, audio, etc).  What class should I be for a custom device, and what does this mean?  (The purposes of my micro is just some hardware control, with some feedback.)

Thanks again.

Accepted Solution

tbrent77 earned 2000 total points
ID: 26286979
You are getting close with your last comment.  It all depends on what your microcontroller is going to 'look like' to the computer.  I wrote .net code to talk to a gsm modem via a serial port but the same class / code also detected my verizon usb modem with no changes.  If your Microcontroller looks like a serial port then it should be very similar if not the same as code you would use to talk to the serial ports.  I cannot help you determine what your mc will look like to the cpu. Just plug it in and look at what the hardware manager thinks it is.  It should also be a help to look at the documentation that comes with the mc unless its all home made.  If it doesn't have a serial port/usb type connection built in, then you most certainly will need drivers.  Drivers are required by almost all usb devices including my verizon modem.  Do you have a driver disk for the mc?  if so, load it and plug it in and let the computer hardware manager tell you what it looks like. This should tell you the class you need to talk to it.
Hope this helps.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It started not too long ago. It was at first annoying. My keystrokes seemed to be randomly generated, not the ones I typed on the keyboard. For some reason this only happened in certain applications (especially browsers such as IE11, Firefox and Chr…
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
Suggested Courses
Course of the Month13 days, 19 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question