AVR Programming & DesignThe source code is provided for each project. The code is for EDUCATIONAL purposes ONLY. There is no warranty and no support. All these projects are a result of my hobby, so I don't necessarily know what I'm doing! |
|||
![]() |
VE3LNY's AVR projectsIt doesn't take long after being introduced to PICs before you hear about AVR microcontrollers and how wonderful they are. AVRs are 8 bit risc microcontrollers, from Atmel Corporation. There are a number of models, from tiny to large, so you can always find a processor to suit your requirements.When starting off with a new line of microprocessors, you need two things: a development language and a programmer. Atmel provides the AVR Studio 4 for free, which provides assembler language. Not being a fan of assembler programming, I was excited to discover that there is a free C language compiler available, called WinAVR. WinAVR includes the GCC compiler and LIBC, a library with lots of useful functions, and numerous of other goodies. |
||
![]() |
AVR ProgrammersIn the programmer department, I found a really simple one here (the schematic is here) which I built. It connects to a PC's serial port and may be driven with a program called AVRDUDE, included in WinAVR. (This programmer is known to AVRDUDE as ponyser). One test showed that that the ponyser took 10 seconds to program an ATmega48 with 3467 bytes of flash data.Atmel has an inexpensive USB-attached programmer called the AVRISP2, which costs about $C45 from DigiKey (P/N ATAVRISP2-ND). I bought one recently; it programs very fast if you set the ISP clock frequency properly. (If the AVRISP's clock frequency is incorrectly set, which it may be by out of the box, it may be really slow or not work at all. I learned this the hard way. Its easy to check/set the clock speed in the Main tab of the programmer software.) Another programmer I thought about trying can be found here. Another interesting approach may be found in Peter Fleury's AVR Starter Kit. Here's a tutorial on AVR micros by Behar Victor. |
||
![]() |
AVR recently released another inexpensive programmer called the AVR Dragon. It is available from DigiKey (P/N ATAVRDRAGON-ND) for around $C60. The nice thing about it is that it supports JTAG, debugWIRE, and High Voltage Serial Programming ( HVSP ). On the down side, you have to make up a bunch of jumpers and set them up for each micro you use. The user manual can be found here. I have found it a lifesaver to rescue a micro that was fused for external crystal and could not be programmed with the AVRISP2. My notes on the AVR Dragon here. |
||
![]() |
In the following projects, I used AVR Studio 4 and WinAVR GCC. After installing both programs, you can create a project with AVRStudio and select GCC as the compiler. I provide all source code but no project files, so you must create your own. Don't forget to specify the processor type and clock speed in the project properties. Then add the source and header files to the project and build. I also include my hex file which ought to work if your hardware is sufficiently identical. |
||
![]() |
LED ClockMy first project was a 6 digit LED clock using an ATMega48. (Program Updated 08/2008) |
||
![]() |
ThermostatHere's a thermostat with an LCD display using an ATMega164. |
||
![]() |
ThermometerA thermometer with an LED display using an ATMega8. |
||
![]() |
Electric Blanket ControllerA versitile Electric Blanket Controller using an ATtiny461. |
||
![]() |
Simple MilliohmmeterHere's a Milliohmmeter using an ATmega168. |
||
![]() |
Temperature and Humidity MeterA Temperature and Humidity meter using an ATmega164P. |
||
![]() |
Timer |
||
![]() |
KTM-S1201 Serial LCD DriverA C-code driver for this display. |
||
![]() |
Appliance TimerAn Appliance Timer using an ATMega88. and a KTM-S1201 LCD display |
||