This is more a gathering of information for ease of use than an outright Instructable. I’m not writing this as an expert on microcontrollers, I’m not. As a matter of fact, I know squat about microcontrollers. But I know programming. I originally created this in order to help someone who did know about microcontrollers to program his stuff and thought this might be helpful to others.
Remove these ads by
Signing UpStep 1Download and install WinAVR
The home page for WinAVR information is http://winavr.sourceforge.net/. Installation is very straightforward, but there is additional, if not outdated and confusing, information located at http://winavr.sourceforge.net/install_config_WinAVR.pdf. WinAVR can be used in conjunction with AVR Studio. It can be downloaded at http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2725. Use of AVR Studio won’t be covered in this Instructable but its use is suggested because it has a simulator and allows step-through of your programs. A good tutorial on its use can be found at http://www.societyofrobots.com/member_tutorials/node/380, Submitted by Antonb on February 25, 2010 - 9:04am.
I’ll be using the USBtinyISP for the examples. It is a custom-make AVR programmer. The home page is http://www.ladyada.net/make/usbtinyisp/index.html. The microcontroller for the examples is an Atmega 328p http://www.atmel.com/dyn/products/product_card.asp?PN=ATmega328P. I will be referencing the datasheet for this controller located at http://www.atmel.com/dyn/resources/prod_documents/doc8271.pdf.
WinAVR comes with AVRDUDE. This is a downloader/uploader for microcontrollers. For testing on the command line, we need to know how to tell AVRDUDE what microcontroller and programmer we’re using, and what we want it to do. This information can be found at http://www.nongnu.org/avrdude/user-manual/avrdude_4.html#Option-Descriptions. The –p flag is the part number/microcontroller number. In this case, the ATmega328P is part number m328p. The -c flag is the programmer-id, in this case, usbtiny. Some other flags we’ll be dealing with are:
–e, this causes a chip erase to be executed, it’s basically a prerequisite command before the flash ROM can be reprogrammed again.
-U memtype:op:filename[:format], this performs a memory operation. In this case, I’ll be using the flash memory, and performing a w write operation, in the test case, using the test_leds.hex file, and in the final case, the main.hex file. I’ll use the default for the [:format].
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|
















































