AVR family is one of the leading 8 bit microcontrollers in its family. There are many reasons why many hobbyists chose this one among other. I don’t say that other families like PIC are worse – no way – can you find even better solutions if needed. Let’s not get in to popular fight “what’s the best”. Smart engineers don’t fight – they simply choose the one that will do the job with less effort, less cost and probably the one that are most familiar with.
Let’s stick with AVR for a while as it is quite popular type among today’s hobbyists. Who don’t know Arduino? It is also based on AVR MCUs. So, interest in AVR is big, demand is big, but one thing is missing – knowledge on how to program these babies effectively. You can find tons of various libraries and tutorials on how to do simple tasks like LED blinking, USART, I2C SPI communications and other interfacing. This is great, but when your project grows in to something bigger you are stuck because simple big while() loop in main routine can’t do business anymore.
Long time it’s been in my head so I decided to give it a try – write a tutorial that would show the very basics of interfacing and programming AVR along with understanding what is really going on when it is running. I bet very few people are programming in ASM language. And even fewer are familiar with it. Especially starters are stuck with C or other higher level languages with no idea what happens in hardware. I don’t say this is bad. Most microcontrollers have enough resources to keep up with non effective programs. But programs tend to grow bigger this way more visible problems become. It is better to learn do it right at the beginning than try to change things later. This saves time – believe me.
In this AVR tutorial set I am going to display things gradually from very basic towards more sophisticated and efficient ways of solving problems. You will have to choose what’s best for you. The word efficient is very “slippery” meaning that code may be very efficient for machine but not readable for human in other hand program it can be very easy and convenient for human but not as good for machine.
And yes, tutorial is going to be based on C language (AVR GCC). For deeper analysis may be ASM introduced to show what’s going on underwater. All code examples will be published from real working programs. So you’ll be able to download and try them by yourself. Don’t hesitate to comment, correct or add if something will be missing. Nobody is perfect so many things may be missing. I am still learning a lot. I hope you and I will enjoy the process and results.