Click here to Skip to main content
15,937,066 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey everyone.

I have 2 main questions to ask to the experts. Now, here is the situation.

I have a micro controller which is a pic 18f2550. 18f2550 supports USB to communicate in high rates of data transfer over PC.

First, question I want to ask is:

How can I send data over data to pic, so that it can make simple i/o operations such as led blinking... As far as I know, the .Net framework doesn't support a class to implement code easily. So What should I do?

Second question: if I want to make, for example a data acquisition card, that gets data over USB, do I have to write a driver for that device? if so, How can I do that? Making libraries in C++ and embed them in C# project?

I need any kind of suggestions guys, so any idea will be well appreciated.

My best regards...
Updated 1-Oct-11 12:59pm

Some PICs do support USB directly, but if you are able to modify the hardware, then use a FTDI device. It can connect to the PIC by a parallel 8 bit port or by the PIC COM ports (usually RC6, RC7), there are FTDI devices for both methods. The good thing about this solution is there are excellent USB device drivers for most common O/S. On the Windows side (I believe Linux drivers are also available), there are simple API functions to read/ write data to the device (FT_Open(), FT_Read(), FT_Write(), etc). There are also COM port emulation in the same driver, so you can talk to the USB device like it was a Windows COM port. On the PIC side, use interrupts to read the data from the parallel port or COM port.



Share this answer
Un_NaMeD 1-Oct-11 17:33pm    
Hey geoff.
I know FTDI devices. They are excellent assembly chips that you can use to act com ports like a usb device, I used them once in a project. But this time, I must do with USB.
This com port emulation you talked about? Does the performance of the USB decrease while using them? Any pros&cons you know them about?
Thank you...
FTDI are USB devices. They are supplied with excellent device drivers.
If you connect the FTDI chip to the PIC using the async interface (RC6, RC7) it will be slower than a parallel interface, due to the baud rate. There is a paper of the FTDI website that tells how to optimize data rate, however you will not get full USB rates as I think it will be limited by the on-chip buffer memory and the PIC clock speed.
Share this answer
Un_NaMeD 1-Oct-11 18:01pm    
Thanks for the infos geoff. The FTDI's are nice but irrelevant in my spot.
(I guess you're new in here. you can "reply" a comment without adding a solution.
Thank you...
geoff7 1-Oct-11 18:07pm    
Thanks - just found the comment link !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900