A Guide to AVR Microcontroller [PDF]

5/8/2023 11:35:02 AM

Ⅰ Introduction

The AVR microcontroller is a RISC microcontroller introduced by Atmel in 1997. RISC does not simply reduce the number of instructions but increases the speed of computing by making the structure of the computer simpler and more rational.

In 1997, Mr. A and Mr. V of ATMEL's Norwegian Design Center developed a high-speed 8-bit microcontroller with RISC streamlined instruction set, or AVR for short, using ATMEL's new Flash technology.

Atmel AVR source simple Wikipedia.jpg

Atmel AVR (source: simple Wikipedia)

Ⅱ Features

RISC gives priority to simple instructions that are used frequently and avoids complex instructions. It also fixes the instruction width and reduces the variety of instruction formats and addressing methods, thus shortening the instruction cycle and increasing the operating speed. Because AVR adopts this structure of RISC, all AVR series microcontrollers have a high-speed processing capability of 1MIPS/MHz (million instructions per second/ megahertz).

High reliability, high functionality, high speed, low power consumption, and low price are the important indicators to measure the performance of microcontrollers, and also the necessary conditions for microcontrollers to occupy the market and survive.

Ⅲ Background

Mainly due to the process and design level, power consumption, and anti-interference performance, the early microcontroller took a conservative program: that is, the use of a higher frequency division factor on the clock division, making the instruction cycle long and slow execution speed. Although later CMOS microcontrollers use measures such as increasing the clock frequency and reducing the crossover coefficient, this state has not been completely changed (51 as well as 51 compatible). In the meantime, although there are some streamlined instruction set microcontrollers (RISC), they still follow the practice of clock division.

The introduction of the AVR microcontroller, completely break this old design pattern and abandoned the complex instruction computer (CISC). It adopts a streamlined instruction set, using a word as the instruction length unit, and arranges the content-rich operands and opcodes in a word (most of the single-cycle instructions in the instruction set are like this). The short fetch cycle and the ability to pre-fetch instructions enable high-speed execution of instructions. Of course, this leap in speed is backed by high reliability.

Ⅳ Advantages

(1) The AVR microcontroller hardware structure adopts a compromise strategy between 8-bit and 16-bit machines, i.e., a local register storage heap (32 register files) and a single high-speed input/output scheme, i.e., input capture registers, output comparison matching registers, and corresponding control logic. It increases the instruction execution speed (1Mips/MHz) and enhances the functionality. At the same time, it reduces the overhead of peripheral management, relatively simplifies the hardware structure, and reduces the cost. Therefore, the AVR microcontroller is a cost-effective microcontroller with an optimized balance of software/hardware overhead, speed, performance, and cost.

AVR microcontroller development board.jpg

AVR microcontroller development board

(2) Enhanced high-speed asynchronous/synchronous serial port with hardware generation of parity codes, hardware detection, and parity error detection, two-stage receive buffer, automatic baud rate adjustment positioning (when receiving), masked data frames, etc... It improves the reliability of communication, facilitates program writing, makes it easier to form distributed networks, and realizes complex applications of multi-computer communication systems. The serial port function greatly exceeds that of MCS-51/96 microcontrollers, coupled with the AVR microcontroller's high-speed and short interrupt service time, so it can achieve high baud rate communication.

(3) Embedded high-quality Flash program memory, easy to erase and write, support ISP and IAP. The embedded long-life EEProm can save key data for a long time to avoid power loss. The on-chip large-capacity RAM not only meets the use of general occasions, but also more effectively supports the development of system programs using high-level languages, and can be extended with external RAM like the MCS-51 microcontroller.

(4) Byte-oriented high-speed hardware serial interface TWI, SPI. TWI is compatible with the I2C interface, with ACK signal hardware transmission and identification, address identification, bus arbitration, and other functions. It can realize the master/slave to send/receive all four combinations of multi-computer communication. SPI supports master/slave and the other four combinations of multi-computer communication.

(5) Automatic power-on reset circuit, independent watchdog circuit, low-voltage detection circuit BOD, multiple reset sources (automatic power-on/off reset, external reset, watchdog reset, BOD reset), settable post-start delay runtime program, enhancing the reliability of the embedded system.

(6) I/O lines all with settable pull-up resistors, can be individually set as input/output, settable (initial) high-resistance input, strong drive capability (can eliminate the power driver parts), and other features so that the I/O port resources are flexible, powerful and can be fully utilized.

(7) On-chip with a variety of independent clock dividers, respectively, for the use of UCAT, I2C, SPI. Among them, with an 8/16-bit timer with up to 10-bit prescaler, can be set by software to provide a wide range of timing time.

(8) Unique "Timer/Counter (single) bi-directional counting to form a triangular waveform. It works with the "output comparison register" to generate pulse width modulation output PWM design method, i.e., variable air ratio, variable frequency, and variable phase square wave.

(9) It has a variety of power-saving sleep modes and can operate with wide voltage (5-2.7V). It has a strong anti-interference capability, which can reduce the software anti-interference design workload and hardware usage in general 8-bit machines.

Ⅴ Part number identification

1. The letter following the model number indicates the voltage working range. With "V": 1.8-5.5V; if default, without "V": 2.7-5.5V.

Example: ATmega48-20AU, without "V" means the working voltage is 2.7-5.5V.

2. The numeric part of the suffix indicates it supports a very high system clock.

Example: ATmega48-20AU, "20" means it can support a very high system clock of 20MHZ.

3. The first (second) letter of Suffix, indicating the package. "P": DIP package, "A": TQFP package, "M": MLF package.

Example: ATmega48-20AU, "A" means TQFP package.

4. The last letter after the suffix indicates the application level. "C": commercial grade, "I": industrial grade (leaded), "U" industrial-grade (lead-free).

Example: ATmega48-20AU, "U" means lead-free industrial grade, ATmega48-20AI, "I" means leaded industrial grade.

Ⅵ AVR microcontroller selection

The AVR microcontroller series is complete and can be applied to the requirements of various different occasions.

AVR microcontrollers are available in 3 grades.

  • Low-grade Tiny series: mainly Tiny11/12/13/15/26/28 etc;

  • Mid-range AT90S series: mainly AT90S1200/2313/8515/8535, etc.; (being phased out or transformed into Mega)

  • High-grade ATmega: mainly ATmega8/16/32/64/128 (storage capacity of 8/16/32/64/128KB) and ATmega8515/8535, etc.

AVR device pins from 8 to 64 pins, and a variety of different packages to choose from.

Recommended News


FPGA vs. Microcontroller Technology: Similarities and Differences

FPGA vs. Microcontroller Technology: Similarities and Differences


What is LED Drive Power?

What is LED Drive Power?


Latches, Flip-Flops, Registers and Buffers

Latches, Flip-Flops, Registers and Buffers


What is Cat 7 Cable?

What is Cat 7 Cable?






Contact Us

Contact Us