01 Introduction To AVR
01 Introduction To AVR
Introduction to AVR
1
Topics
www. Micro Digital Ed. com
BIHE university
• AVR Features
2
General Purpose Microprocessors vs.
www. Micro Digital Ed. com
Microcontrollers BIHE university
• Although this makes the system bulkier and more expensive, it has
the advantage of versatility giving the designer more flexibility to
decide the amount of resources needed for a given task
3
General Purpose Microprocessors vs.
www. Micro Digital Ed. com
Microcontrollers BIHE university
• Microcontrollers
Microcontroller
I/O Serial
RAM ROM Timer
Port Port
CPU
Buses
4
Single Chip microcontrollers
• Typical elements found in a μcontroller include:
– CPU (typically 4 – 64 bit word size) – also as
multicores.
– Memory (typically a few hundred Bytes to many
MBytes) as RAM, ROM, EPROM and/or Flash.
– Clock generator.
– Timers and general interrupt logic.
– General purpose digital I/O lines – often combined with
PWM generators, counters, watchdog- or timer-
triggers.
– A/D and D/A converters (typically 6-12 bit).
– Communication channels: Ethernet, UART, I2C, Fast
serial, CAN-bus etc.,
5
Criteria for choosing a Microcontroller
• The important features that influences the choice of a
Microcontroller system :
– CPU processing power
• Word length (8, 16, 32 bits): important for precision of calculations
and memory access
• Speed: The highest speed the microcontroller supports and
Transfer rates between CPU memories and I/O.
• Number of registers: The more registers we have, the more
intermediate computation results can be held on the CPU (without
the need to access main memory), the more faster processing
• Power consumption
• Cost per Unit
– Storage capabilities and I/O interfaces:
• RAM, ROM, EPROM and auxiliary storage unit .
• Number of I/O pins and timers in the Chip.
– Availability of development tools (compiler, debugger, etc.)
6
Review questions
www. Micro Digital Ed. com
BIHE university
7
Review questions
www. Micro Digital Ed. com
BIHE university
8
Most common microcontrollers
www. Micro Digital Ed. com
BIHE university
• 8-bit microcontrollers
– AVR
– PIC
– MC68HC05
– 8051
• 32-bit microcontrollers
– ARM
– AVR32
– PIC32
9
Review Questions
10
Review Question Answers
11
The AVR Microcontroller
AVR stand for ?
Advanced Virtual RISC, (formerly: Alf and Vegard's RISC)
The founders are Alf Egil Bogen and Vegard Wollan
two students at Norwegian Institute of Technology (NTH) and
further refined and developed at Atmel Norway, the Atmel
company founded by the two chip architects.
12
The AVR Architecture
• The AVR is a Harvard architecture CPU.
– Harvard Architecture
• Computer architectures uses physically separate storage and signal
pathways for their instructions and data.
– CPU can read both an instruction and data from memory at the same
time, makes it faster.
13
AVR internal architecture
www. Micro Digital Ed. com
BIHE university
PROGRAM
ROM
Program
Bus Bus
CPU
Interrupt Other
OSC Ports
Unit Peripherals
I/O
PINS
14
The AVR Architecture
• Single clock cycle per instruction execution
– Compared to PIC : 4 clock cycles per instruction
– One MIPS (mega instructions per second) per MHz
– Up to 20 MHz
– 8 MHz = 8Mips
• “LOAD" and "STORE“ instructions to access memory
15
The AVR Memory Architecture
16
The AVR Memory Architecture
www. Micro Digital Ed. com
BIHE university
17
Review questions
www. Micro Digital Ed. com
BIHE university
18
Let’s get familiar with the AVR part numbers
www. Micro Digital Ed. com
BIHE university
ATmega128
Atmel group
Flash =128K
ATtiny44 AT90S4433
Atmel
Tiny Flash =4K Atmel Classic
Flash =4K
group group
19
ATMEGA 8 AVR Microcontroller
• 8K bytes of Flash
• 512 bytes EEPROM
• 1K bytes SRAM
• 23 General Purpose I/O
(GPIO) lines
• Timers : 8bits (2), 16
bit (1)
• 3 PWM channels
• 8-channel 10-bit ADC
• 1 UART and 1 SPI serial
interfaces
In other models (e.g. ATmega16 & ATmega32 there is one additional port (PORT A)
20
RECOMMENDED PROBLEMS
PROBLEMS HIGHLIGHTED IN RED
www. Micro Digital Ed. com
BIHE university
Problems:
S1.1 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).
S1.2 (14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28).
21