AVR Microcontroller Tutorial – The complete guide to learn AVR

We have developed a complete guide to learn AVR microcontroller – a tutorial which teaches the architecture,pin diagram,how to program an avr micro controller, how to work with ADC of avr, how to work with SPI of avr,interfacing LCD with avr, the avr gcc library, how to work with external interrupts, how to establish a USART communication etc. We have also developed a simple project to try your hands on – a frequency counter circuit built using Avr Atmega8. The whole series of articles for this tutorial were developed by our young author Rakesh Bute. We owe him a million…
Read MoreHow to work with the ADC unit of an AVR Micro-controller

Introduction The first step to digital signal processing is to convert a signal into digital data, and here the Analog to Digital Converter devices comes into action. Some of the AVR micro controllers include ADC unit in their features. This is a very useful unit for measurement related applications. The ADC used in AVR micro controllers are of successive approximation converter type. Read the Wikipedia article on SAR type ADC here. And you can read the Circuitstoday article too. Using the ADC Unit SAR type ADC needs these following things to run properly: A very stable, low internal impedance,…
Read MoreWorking with External Interrupts in AVR micro controller

Introduction to Interrupts Although micro controllers can accept inputs from Digital I/O Ports,interrupts are preferred for accepting inputs generated by external events. This is mainly because of the less attention required for an interrupt based program. An Interrupt Event directs the flow of program execution to a totally independent piece of code, known as “Interrupt Sub-Routine”. There are many sources of Interrupts that are available for a micro controller. Most of them are generated by the internal modules and are known as internal interrupts. And there are two pins that accept external signals directly and allows external sources to…
Read MoreHow to Establish A PC-Micro controller USART communication
Introduction USART is one of the primitive inter-device communication protocols. It is not used in modern computers. But still, a few mother boards come with the module necessary for an USART communication. Here, in the case of PCs, the port is known as COM port and it follows RS232 protocol. It is no different from USART except for the voltage levels and some additional signals. Commonly MAX232 IC is used to translate the voltage level. MAX232 is a simple voltage translator buffer that converts +12/-12V of RS232 to 5/0V for USART. Other specifications are similar for USART and RS232. To…
Read MoreHow to Work With SPI in AVR Micro Controllers
Introduction Micro controllers support wired communication protocols. Most of the time, microcontrollers come along with internal modules that support these protocols. The commonly supported protocols are: UART or USART communication SPI TWI USI etc. And few advanced protocols like: USB CAN Ethernet etc. SPI stands for Serial Peripheral Interface and it is the simplest among all the communication protocols. 8bit data registers in the devices are connected by wires. These data registers works as shift registers and one of the device controls the data exchange inside the SPI Network. The device or devices that controls the operation inside the…
Read MoreHow to Work With 32K crystal and AVR Microcontroller
This article teaches you how to add 32K external crystal source to AVR micro controller (Atmega8 ) with circuit diagram & C program. Introduction Timing-is one of the basic function, performed by the micro controllers. Every microcontroller has at least one timer/counter module in its architecture. However if the counter is clocked internally a few issues may arise in some cases. Sometimes the clock frequency may not stable, or sometimes the clock frequency may be too high than necessary. Sometimes external clock is required to have the required quality. To solve these problems, some AVR micro controllers comes up with…
Read MoreFrequency counter circuit
Simple Frequency Counter You may have already seen various projects over many websites named Frequency counter, Digital Frequency Counter etc. I’m posting just another of them. Showing the use of timer/counter of AVR micro controller (Atmega8) in one of it’s form. This circuit can be used as a simple micro controller project for your engineering courses. Frequency of a periodic signal is the number of cycles it repeats per second! So If we count the number of cycles recorded in a second it will directly read the frequency. So what we are going to make is a frequency counter circuit,…
Read MoreStandard Library & String Formatting for AVR
Here in this article, I am planning to brief you through the Standard library of AVR-GCC. By the term “Standard Library” we mean the “Standard header” files like “stdio.h”, we commonly see in C programming language. Have you ever used String Formatting in ANSI C? Did you use Standard library functions? If you are familiar with C programming language, then you must be familiar with standard header files we write in the beginning of the program like “#include stdio.h“, “#include stdlib.h ” , “#include conio.h” etc etc. The most important of all header files is the header file -which simply…
Read MoreLCD Interfacing with AVR
Interfacing LCD Display in 8bit Mode I’ve already discussed about the LCD display in a note here in this website. You can read the Note on character LCD Display here. Now let us come to the interfacing side of LCD. Let us see the 8bit mode interfacing of the LCD display with an AVR micro controller first. I have added two circuits in this post 1) Interfacing LCD with Avr Atmega8 and 2) Interfacing with Atmega32. Towards the end you can see the real life display as an image where I displayed characters“Circuits Today” Here to interface LCD with…
Read MoreHandling the Digital Input Output in AVR Micro Controllers
I have already discussed about a few chapters necessary to get into AVR programming. Now this is the first article that deals with programming. Let us start with the basics. Digital input output (I/O) is the basic feature supported by AVR micro controller. To facilitate digital input output, three registers are associated with each port of the micro controller. Data Direction Register- This register determines which of the pins will act as an output port, and which of them as input. Data Output Register-This register holds the Data output to the port. Data Input Register- Reads data from the port…
Read MoreAvr Atmega8 Microcontroller – An Introduction

In my previous article, I’ve discussed about ATmega32. Now, let me introduce another member of AVR microcontroller family, the ATmega8. This member has many features similar to that of ATmega32. But it has reduced number of features and capabilities, yet it has enough features to work with. Now let me tell you that if you want to gather knowledge and at the same time want to do it in less cost than the budget of ATmega32, you can think of making projects with ATmega8. In that case, one feature you won’t be able to realize is the JTAG interface. But…
Read MoreAVR GCC Library of AVR Studio – An Overview
In embedded C, pre defined libraries play very important role in compiling a program and significantly reduce the code size for the same. However, the optimization and the output file size are very much dependent upon the compiler. In AVR Studio predefined library is pretty big and it is a very complex one. To offer portability a huge amount of work has been made in its Header files. What’s so interesting is that, AVR guys has been successful to keep the rules for its embedded C (for Avr controllers) closer to that of the rules for ANSI C. They resolved…
Read More