• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 372
  • Last Modified:

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

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.
0
riceman0
Asked:
riceman0
1 Solution
 
riceman0Author Commented:
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.
0
 
tbrent77Commented:
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.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now