What is An AVR Microcontroller? Basics of AVR Microcontrollers

What is an AVR microcontroller?

AVR microcontroller is an enhanced 8-bit and built-in Flash RISC order set developed by ATMEL. Compared with CISC, RISC is not just to reduce the command simply, but make the structure of the computer more simple and reasonable to improve the speed of the operation. The design absorbs the advantages of 8051 and PIC microcontroller, and has the ability to execute one instruction in a single clock cycle. The speed can reach 1Mips/MHz. AVR microcontrollers are widely used in the outside devices of the computers, industrial real-time control, instrumentation, communication equipment, home appliances and other fields.


Article CoreAVR Microcontroller
FeaturesTen Points
ClassificationThree Series
Application Seven Fields
Experimental ToolsNine Tools
Developping ToolsThree Tools

Input, output and Reset

This vedio shows you how to build your own AVR development board and how to use it in your projects.

The hardware structure of AVR adopts a compromise strategy of 8-bit and 16-bit computer, that is, the local register memory stack (32 register files) and the single high-speed input / output scheme (i.e. input capture register, the output compares matching registers and corresponding control logic) are adopted, improving the execution speed of instruction, overcoming the bottleneck phenomenon, and enhancing the function. At the same time, it reduces the cost of external equipment management, simplifies the hardware structure and reduces the cost. Therefore, AVR microcontroller is a high performance-price single-chip microcomputer, which has achieved an optimized balance in hardware / software development, speed, performance and cost.

The introduction of AVR microcontroller breaks this old design pattern completely, abolishes the machine cycle, and gives up the complex instruction computer (CISC) to pursue the instruction complete method; Reducing instruction set, taking words as the unit of instruction length, arranging the rich operands and opcodes in one word (the majority of single-cycle instructions in the order set are the same), and the reference period is short and the instruction can be prefetched, realizing flow operation, so you can execute instructions at high speed. Of course,the high reliability must be required.

AVR Microcontroller

Main features of AVR microcontroller are as follows:

1. High-quality embedded Flash program memory, can be repeatedly written and erased, supporting ISP and IAP, which is easy to have product debugging, development, production, update. Long service-life EEPROM, can save key data for a long time and avoid power loss. High-capacity RAM in chips, supports the development of system programs in high-level languages.

2. High speed, low power consumption, with SLEEP (power saving when sleeping) function. Each instruction can be executed at 50ns/ 20MHz, while power consumption is between l~2.5mA (typical power consumption, when WDT turned off, is lOOnA), AVR (with prefetching instruction function) based on Harvard structure concept. That is, there are different memories and buses for program storage and data, when an instruction is executed, the next instruction is pre-removed from the program memory. This allows instructions to be executed within each clock cycle. The AVR microcontroller can operate at a wide voltage (2.7V~5V), has strong anti-jamming ability, and reduces the general 8-bit computer software anti-interference design and hardware usage.

3. All the I/O lines of AVR single-chip computer have adjustable pull-up resistor. The input and output characteristics of parallel I/O port are similar to those of PIC's HI/LOW output and three-state high impedance H1-Z input, also be set similar to the 8051 series of internal high resistance as input function. It can be set as an input / output, or can be set as high resistance input initially. So that I/O resources are flexible, powerful, and fully utilized. AVR's I/ O which can accurately reflect the input / output of I/O.

4. AVR microcontroller has a variety of independent clock divider for URAT, IIC, SPI. The prescaler with up to 10 bits when matching with the 8 / 16 bit timer, can set the frequency division coefficient through software to provide a variety of timing time. The timer / counter (single) in AVR microcontroller can be counted bidirectionally to form triangle wave, then matched with the output comparison matching register, the output PWM of pulse width modulation with variable duty cycle, variable frequency and variable phase square wave is generated.

5. For industrial products, with high current (irrigation current) lO=20mA~40mA (single output), can directly drive SSR or the relay. The built-in watchdog timer (WDT) is used to avoid the faulty program and improve the anti-interference ability of the product.

6. Superfunctional streamlined instruction. There are 32 general working registers (equivalent to 32 accumulators in 8051 single-chip computer), which overcomes the data processing problems caused by single accumulator.

7. AVR microcontroller has analogue comparator, I/O port can be used for A/D conversion, can form cheap A/D converter.

8. Byte oriented high-speed hardware serial interface TWI and SPI. TWI is compatible with I2C interface, with ACK signal hardware transmission and recognition, address recognition, bus arbitration and other functions, It can realize all four kinds of multi-machine communication of from one to another. SPI has the same function. It also look like the 8051, AVR has multiple fixed interrupt vector entry addresses, so it can respond to interrupts quickly, and it will interrupt like PIC at the same vector address.

9. AVR microcontroller has automatic power up reset circuit, independent watchdog circuit, low voltage detection circuit BOD, multiple reset sources (automatic up and down reset, external reset, watchdog reset, BOD reset). It can set up delay operation program after running the system, enhancing the reliability of the system. And meanwhile, AVR microcomputer has many power-saving sleep modes, wide voltage operation(2.7V-5V), strong anti-interference ability. So it is used widely in electrical industry due to its advantages.

10. Enhanced high-speed synchronous/asynchronous serial port has the functions of generating checking code based on hardware, hardware detecting and debugging, two-stage receiving buffering, baud rate automatically adjusting position (when receiving), shielding data frame and so on. They improve the reliability of communication and help write the program easily. It also make up the distributed network and to realize the complex application of multi-computer communication system. 

The function of serial port is much more than the serial port of MCS-51/96 microcontroller. In addition, the AVR single chip microcomputer has high-speed operation, and the interrupt service-time is short, therefore, high baud rate communication can be realized. Serial asynchronous communication UART, does not occupy timer and SPI transmission function, because of its high speed, it can work in a standard integer frequency, while baud rate can reach 576Ko11, with multi-channel 10-bit AID converter and real-time clock RTC.

AVR microcontroller technology embodies a variety of devices (including FLASH program memory, watchdog, EEPROM, synchronous/asynchronous serial port, TWI/ SPI/ AID/ A/D converter, timer, counter, etc.) and various functions (enhanced reliability of reset system, reduced power-consumption and anti-interference sleep mode, various interrupt systems, timer/counter with input capture and match output, replaceable I/O port. It fully reflects the modern single-chip technology develop to the "on-chip" SoC system.

Selection of AVR series single-chip Microcomputer

AVR series microcontroller is complete, can be applied to different occasions. In order to make good use of it, it is necessary to know its classification based on different standards and functions. And here are introduce three grades and their models as examples.

AVR microcontroller has three grades:

Low-grade Tiny series: this type microcontroller has Less memory, small in size, apt only for simpler applications, the applying model like Tiny11/12/13/15/26/28, etc.;

Midrange-grade AT90S series: this microcontroller is used commercially for compound applications, it requires large program memory and also high speed, such as AT90S1200/2313/8515/8535 etc.;

High-grade ATmega:  this type microcontroller is the most popular ones which having a good amount of memory up to 256KB, higher built-in peripherals and fit for modest to difficult applications, the applying model like the ATmega8/16/32/64/128 (storage capacity is 8/16/32/64/128KB) and ATmega8515/8535.

AVR device pins range from 8 to 64, with a variety of packages available.

microcontroller's types form

Application Field 

Air conditioning control panel

Printer control board(PRCB)

Intelligent meter

Intelligent flashlight

LED control screen

Medical equipment


Introduction to the experimental tools and equipment used in AVR

IC-CAVR6.31AC Language Compiler

Integrated Development Environment(ATMEL AVR Studio)

PonyProg2000 Download Software

AVR Microcontroller Integrated Test Board

AVR-JTAG Simulator

Parallel Port Loader

High Stability Power Supply

Multifunctional TOP2004 USB Programmer


Programming Software

ICCAVR6.31AC Language Compiler

ICCAVR6.31A is a C programming language compiler developed by ImageCraft for AVR MCU. It is a pure 32-bit with integrated development environment, also consists of editor and project manager.

ICCAVR has been widely used because of its powerful function, simple operation, good technical support and reasonable price. The following figure is the working interface of ICCAVR.

the working interface of ICCAVR

AVRStudio Integrated Development Environment

AVRStudio is an integrated development environment which integrates project management, program assembly, program debugging, program download, JTAG simulation and so on. However, AVRStu-dio does not support C programming language. Therefore, when we develop AVR microcontroller with the C programming language, we should first compile the C programming language with ICCAVR, then open the compiled code file with AVRStudio to debug the program. The following figure is the workspace of SVRAStudio.

 the workspace of SVRAStudio

PonyProg2000 software 

It is mainly used for AVR MCU and PIC MCU program download, can be used in Windows95/98/ME/NT/20001XP operating systems. The following figure is the working interface of PonyProg2000.

the working interface of PonyProg2000


Write with PORTx, read with PINx

During the experiment, try not to connect the pin directly to the GND/VCC. When it is not set properly, the I/O port will output / fill the high current of 80mA (Vcc=5V), resulting in device damage.

As Input

1.The suspension (high resistance state) will be susceptible to interfere if the internal pull-up resistor is usually allowed(generally, it seems that 51 has strong anti-interference ability because 51 always has internal resistance to pull up).

2. Try not to let input suspended or analog input level close to VCC/2, because it will consume too much current, especially in low power applications of CMOS circuits.

3. The pin level provided by the reading software usually requires a clock cycle interval between the assignment instruction “out” and the read instruction “in”, such as the nop order.

4.The input of the functional module (interrupt, timer) can be triggered by low level, also it can be the rising edge trigger or the falling edge trigger.

5.For high-resistance analog signal input, remember not to allow internal pull-up resistor to affect accuracy, such as ADC digital analog converter input, analog comparator input and so on.

As Output

Taking the necessary current limiting measures, for example, drive the LED to serialize the current-limiting resistor.


Internal pull-up resistor will be disabled when reset. If strict level control is required in an application, such as motor control, it is necessary to use an external resistor to fix the level.


As output, it is still in the same state

Input is generally invalid, but the input function is valid if the second function is interrupted. For example, the wake-up function of an external interrupt.

You May Alao LIke

A Complete Guide to Solid State Drive (SSD)

Brief introduction to the Application of some IC chips in Maxim Integrated

Product Recommendation




How to buy
Payment Terms
By PayPal
By Credit Card
By Wire Transfer
By Western Union
After-sales Service
Quality Control
Return & Replacement
About us
Company Profile
Our History
Corporate Culture
Contact us
Join us
© 2008-2018 kynix.com all rights reserved.
Tel:00852-81928838    Email:info@kynix.com