Click here to Skip to main content
15,860,972 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am having a project USB AVR uController interfacing. It will have USB AVR microControllers connecting to computer via USB protocol. AVR will do something as a peripheral boards and transfer it's data to computer as well as the computer will control the board by the console in the screen made by C#.

What I have now is that the basic of C# and being quite familiar with AVR microcontroller programming (ASM) but never done with USB AVR.

I am very new with USB programming so hope experts can advise me what I have to do step by step to carry out the project.

1, What AVR I should to go with in term of pricing and ease of seeking.
2, C# programming side what I have to be equipped in term of writing code and driver for USB.
3, And etc.. which I do not know yet to go through the project.
Posted
Updated 29-Sep-12 4:37am
v2

1) Can't help - it depends on what features you need to do the task. Since they are available in between 8 bit and 32 bit with a wide range of specifications, there is no practical way to advise you.
2) Easy - C# side will just need a SerialPort, with the correct parameters set, and it can talk directly to the AVR. USB is not a communications protocol, it is a physical layer description, so you will ba able to specificy the communications protocol yourslef (and implement it at both ends)
3) Sorry, but answering unasked questions requires the TimeTravel .NET assembly which is still in prototype due to paradox problems in the class constructor.
 
Share this answer
 
Comments
khoa pham van 29-Sep-12 12:04pm    
Thank for quick reply,

Sorry I am still in doubt.
I will use AVR 8 bit which integrates USB interface. What I have to learn is that computer will talk to AVR through USB for transferring data. And window application form will be made by C#. I don know how to get this. Googling show me the USB complete book which is good for deeply understanding USB. However it is so hard for me to start the new thing.
Could you draft what I have to learn to get this done. Especially on how to get communication between C# and AVR.

Thank you very much,
Khoa.
OriginalGriff 29-Sep-12 12:21pm    
If the AVR includes USB, then it *should* be just a case of wiring it correctly, and teh VAR website will include sample code to send and recive bytes via the USB itself - if you follow those it should be no problem.

The C# side will be equally simple: create a SerialPort instance, connect it to the correct COM port number (the MSDN documentation will show this) and it should send and recieve characters from the AVR.
How the two talk to each other to *make sense* is another matter - and will be up to you to define. You can easily debug the Tx/Rx just by making the AVR echo each character it recieves back to the same port.
My suggestion is to start with an Arduino development kit. These use AVR microcontrollers and have a large community that has already created lots of different projects which you may use as guidance. Just select the Arduino board that matches your requirements (not all have USB as far as I know) and then just read through some getting started tutorials.
See these links for more information:
http://arduino.cc/en/[^]
Arduino Unleashed[^]
http://www.technicana.com/physical-computing/73-connect-to-the-arduino-with-c-.html[^]
http://www.instructables.com/id/Interfacing-your-arduino-with-a-C-program/[^]
For interfacing using USB you may want to read about the FTDI virtual serial port that may be used to communicate with an USB device which creates a virtual com port on Windows.
Enjoy coding!!
 
Share this answer
 

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