views:

410

answers:

4

I want to develop code to transmit data from system to PIC through USB. Can anybody give good link regarding data transmission through USB. because i am new to this.

NOTE: Very simple is code is enough to me.

Thanks in Advance

A: 

As your task will involve Windows Device Driver development, I do recommend to downlaod and install the WDK and look through the contained sample USB drivers.

This might get you some hints about the complexity of the topic. Device driver development is not the easiest thing to start with.

Maybe you can start with UART communication (RS232).

Frank Bollack
Untrue; you don't need to write a driver if the device falls in any of the default-supported classes. The most obvious candidate is HID (Human Input Device)
MSalters
The OP is asking for data transmission. I can't see how HID class drivers would be useful for him. Maybe you can make some suggestions in an own answer.But I agree with you, that there are some other driver classes (like USB-COM-Ports, as Ian stated) that he could use without programming its own driver.All depends on the PIC-hardware he's using.
Frank Bollack
What do you think HID class devices do, if not transfer data? I've seen not only mice and keyboard, but digitizer tablets, uninterruptible power suppliers, etc., using the HID class.
Ben Voigt
+3  A: 

The PIC16F877 does not have a USB peripheral built in. I assume that the product that you are building is a "USB Device" and that the "system" that you are referring to will provide the USB host functionality. If this is the case then you will have to add a USB interface chip to your hardware to provide async serial to USB connectivity. Suitable devices are made by TI (TUSB series) or FTDI. You then connect one of these to the PIC internal USART and pretend that you are transferring the data over a simple serial port. If you are using a pc then the connected device will appear as a standard COMn: port.

Ian
+1  A: 

I totally agree with the FTDI route, however if you're not looking for a UART tunnel over USB then you have to get a bit more in-depth.

You'll have to write the USB routines yourself or find libraries/projects for your processor. What you will definitely have to have is a fast clock - 12MHz is necessary More is better because on small uC's like these you'll spend most of your time just handling the basics of USB - signaling and so forth. You'll also need a fair bit of memory because the USB code takes up around 1.5K I think. Then you need room afterwards for your own code.

I've seen the V-USB (http://www.obdev.at/products/vusb/index.html). It's for AVR not PIC, but it says it provides all of the USB functionality you'll need and even provides vendor and product IDs for you to use (non-commercial I believe). There's also a PIC project for USB that doesn't run on the same hardware as yours here: http://www.alanmacek.com/usb/

To make the driver you'll have to use libusb - here's a link for the win32 version: http://libusb-win32.sourceforge.net/

It's surprisingly more simple than I had expected, but I just looked at example code and not actually made anything. Good luck!

Stephen Friederichs
Thanks Stephen Friederichs. I got lots of basic information from that link(http://www.alanmacek.com/usb/). I will check the same source code in my Environment and let you know asap.
ASHOK
Easiest way is just to stick an FTDI chip on the uP serial port and use the regular FTDI usb serial driver on the PC end?
Martin Beckett
A: 

check http://www.beyondlogic.org/usbnutshell/pic16f876.gif will surely help u also ttp://www.beyondlogic.org/usbnutshell/usb7.htm , type h in front of 2nd link.

sushant yadav