You are on page 1of 21

www. Micro Digital Ed.

com
BIHE university

Chapter 1
Introduction to AVR MCU

The AVR microcontroller


and embedded
systems
using assembly and c

AVR Microcontroller and Embedded System Using Assembly and C © 2011 Pearson Higher Education,
Mazidi, Naimi, and Naimi Upper Saddle River, NJ 07458. • All Rights Reserved.
Objectives
Upon completion of this chapter, you will be able to:
• Compare and contrast microprocessors and
microcontrollers
• Compare and contrast the various members of the
AVR family
• Compare the AVR with microcontrollers offered by
other manufacturers

2
Topics
1. Microcontrollers vs. Microprocessors
2. AVR Features
3. AVR members

3
General Purpose MPU vs. MCU
• General Purpose Microprocessors
General I/O Serial
Purpose RAM ROM Timer
Port Port
Micropro
cessor
(CPU) Buses

• Microcontrollers
Microcontroller

I/O Serial
RAM ROM Timer
Port Port
CPU

Buses

4
Differences between microcontrollers and
microprocessor

• Contains a processor • Processor is standalone,


• Has memory and I/O memory and I/O
modules integrated on • modules are seperate
• the same chip • Designer can choose
components for memory
• Compact • and I/O
• Cheap • High processing power
• Small power consumption • General purpose

5
Most common microcontrollers
• 8-bit microcontrollers
– AVR
– PIC
– HCS12
– 8051

• 32-bit microcontrollers
– ARM
– AVR32
– PIC32
– CodeFire
– PowerPC
6
Some of the Companies that Produce Widely
Used 8-bit Microcontrollers
Company Web Site Architecture
• Atmel http://www.atmel.com AVR and 8051
• Microchip http://www.microchip.com PIC16xxx/18xxx
• Intel http://www.intel.com/design/mcs51 8051
• Philips/Signetics
http://www.semiconductors.philips.com 8051
• Zilog http://www.zilog.com Z8 and Z80
• Dallas Semi/Maxim
http://www.maxim-ic.com 8051
• Freescale Semi
http://www.firecscale.com 68HC11/HCS08
• See http://www.microcontroller.com for a complete list.

Note: In 2016, Microchip agreed to buy Atmel for US$3.6 (equivalent to $3.76 in
2018) billion in a deal brokered by JPMorgan Chase and Qatalyst.
7
Comparison of 8051, PIC18 Family,
and AVR (40-pin package)
Feature 8052 PIC18F452 ATmega32
• Program ROM 8KB 32KB 32KB
• Data RAM 256B 2KB 2KB
• EEPROM 0B 256B 1KB
• Timers 3 4 3
• I/O pins 32 35 32

8
Topics
1. Microcontrollers vs. Microprocessors
2. AVR Features
3. AVR members

9
Introduction to Atmel AVR
• Atmel Corporation is a manufacturer of semiconductors,
founded in 1984.

• Atmel introduced the first 8-bit flash microcontroller in 1993,


based on the 8051 core.

• In 1996, a design office was started in Trondheim, Norway, to


work on the AVR series of products.

• Its products include microcontrollers (including 8051 derivatives


and AT91SAM and AT91CAP ARM-based micros), and its own
Atmel AVR and AVR32 architectures.

10
Introduction to Atmel AVR
• The AVR architecture was conceived by two students at the Norwegian
Institute of Technology (NTH) Alf-Egil Bogen and Vegard Wollan.
• The AVR is a modified Harvard architecture 8-bit RISC single chip
microcontroller which was developed by Atmel in 1996. The AVR was one of
the first microcontroller families to use on-chip flash memory for program
storage, as opposed to one-time programmable ROM, EPROM, or EEPROM
used by other microcontrollers at the time.
• The AVR is a modified Harvard architecture machine where program and data
is stored in separate physical memory systems that appear in different address
spaces, but having the ability to read data items from program memory using
special instructions.
• Atmel says that the name AVR is not an acronym and does not stand for
anything in particular. The creators of the AVR give no definitive answer as to
what the term "AVR" stands for. However, it is commonly accepted that AVR
stands for Alf (Egil Bogen) and Vegard (Wollan)'s Risc processor"

11
CISC vs RISC
CISC RISC
Emphasis on hardware Emphasis on software
Include multi-clock complex instructions Include single-clock reduce instruction only

Memory-to-memory: “Load” and “Store” Register-to-register: “Load” and “Store” are


incorporated in instructions independent instructions
Small code sizes, high cycles per second Low cycles per second, large code sizes
Transistors used for storing complex Spends more transistors on memory registers
instructions
Reduced Instruction Set Computer (RISC) vs Complex Instruction Set Computer (CISC)
• RISC vs. CISC is a topic quite popular on the Net. Every time Intel (CISC) or Apple (RISC) introduces
a new CPU, the topic pops up again.
• Most PC's use CPU based on CISC architecture. For instance Intel and AMD CPU's are based on
CISC architectures.
• Many people claim that RICS is the architecture of the future.
• But even though RISC has been in the market since 1980, it hasn’t managed to kick CISC out of
the picture, some argue that if it is really the architecture of the future it should have been able
to do this by now.
12
CISC vs RISC
Complex Instruction Set Computer (CISC)
• Larger architecture
• Variable code size
• Powerful instruction set
• Requires several clock cycles to execute
instructions

Reduced Instruction Set Computer (RISC)


• Simple architecture
• Small set of instructions
• One or few clock cycles to execute instructions

13
Computer architectures
Von Neumann vs Harvard

• Code and data are accessed • Separate buses for


through the same bus accessing code and data
• Results in a bottle neck • Faster
since we can’t access code • Less delays
and data at the same time • Requires more hardware
• More delays
14
AVR Core
• RISC with Harvard architecture
• Code ROM
• Data RAM
• Data EEPROM
• Timers
• I/O ports
• ADC
• PWM
• Communication interfaces:
USART, SPI,
• I2C (TWI), CAN, USB
• Overview

15
AVR internal architecture

RAM EEPROM Timers

PROGRAM
ROM

Program
Bus Bus
CPU

Interrupt Other
OSC Ports
Unit Peripherals

I/O
PINS

16
ATmega32 PDIP Package

40 PIN DIP
(XCK/T0) PB0 1 40 PA0 (ADC0)
(T1) PB1 2 39 PA1 (ADC1)
(INT2/AIN0) PB2 3 38 PA2 (ADC2)
(OC0/AIN1) PB3 4 MEGA32 37 PA3 (ADC3)
(SS) PB4 5 36 PA4 (ADC4)
(MOSI) PB5 6 35 PA5 (ADC5)
(MISO) PB6 7 34 PA6 (ADC6)
(SCK) PB7 8 33 PA7 (ADC7)
RESET 9 32 AREF
VCC 10 31 AGND
GND 11 30 AVCC
XTAL2 12 29 PC7 (TOSC2)
XTAL1 13 28 PC6 (TOSC1)
(RXD) PD0 14 27 PC5 (TDI)
(TXD) PD1 15 26 PC4 (TDO)
(INT0) PD2 16 25 PC3 (TMS)
(INT1) PD3 17 24 PC2 (TCK)
(OC1B) PD4 18 23 PC1 (SDA)
(OC1A) PD5 19 22 PC0 (SCL)
(ICP) PD6 20 21 PD7 (OC2)

17
Topics
1. Microcontrollers vs. Microprocessors
2. AVR Features
3. AVR members

18
AVR different groups
• Classic AVR
– e.g. AT90S2313, AT90S4433
• Mega
– e.g. ATmega8, ATmega32, ATmega128
• Tiny
– e.g. ATtiny13, ATtiny25
• Special Purpose AVR
– e.g. AT90PWM216,AT90USB1287

19
Let’s get familiar with the AVR part numbers
ATmega128

Atmel group
Flash =128K

ATtiny44 AT90S4433

Atmel
Tiny Flash =4K Atmel Classic
Flash =4K
group group

20
AVR Atmega — Robust and Flexible

21

You might also like