AVR Microcontrollers
AVR Microcontrollers
AVR Microcontrollers
Topics
Introduction to AVRs
AVR Architecture & Instruction Set
Focus on Atmega128 AVR
AVR Programming
Why Microcontroller?
Purpose ?
Microcontroller
• Microcontrollers are important part of
Embedded systems
• To understand Structure & working of
Microcontrollers
• For Designing good Embedded system
complete understanding of
microcontrollers required
Microcontroller
Integrated chip that typically contains integrated CPU,
memory (RAM ROM), I/O ports on a single Chip.
(RISC)
Instruction execute in single cycle
CISC Approach
RISC Approach
Harvard Architecture
Harvard Architecture
• Registers
• Instruction Set
• I/O ports
• Memory (flash & RAM & ROM)
• CPU
AVR Architecture
Registers: Two types of registers
GERNEL purpose & SPECIAL purpose registers
GERNEL purpose
32 general purpose registers having storage capacity of 8-Bits
Named as R0,R1,R2 to R31.
Register 0 to 15 & 16 to 31 are different.
Can store both Data & Addresses.
I T H S V N Z C
AVR
Register Architecture
AVR Architecture
Memory:
Data Memory
AVR
AT90S2313 Memory Architecture
Memory:
ADD Rd,Rr
Rd: Destination (and source) register in the Register File
Rr: Source register in the Register File
AVR
AT90S2313 instruction Architecture
Three components.
5 red bits 00011 distinguish this as an add instruction.
5 blue bits 10111 indicates register 23 is the first
operand register.
The 5 green bits 01011 indicates register 11 is the
second operand register.
All add Rd, Rr instructions follow this pattern.
AVR AT90S2313 I/O Pins
Three I/O memory address locations are allocated for the Port B,
Data Register (Read/Write) PORTB, ($38),
Data Direction Register (Read/Write) DDRB, ($37)
PortB Input Pins (read-only, )– PINB, ($36).
Three I/O memory address locations are allocated for the Port D:
Data Register (read/write)– PORTD, $12($32),
Data Direction Register (read/write)– DDRD, $11($31)
Port D Input Pins(read-only) – PIND, $10($30).
AVR AT90S2313 I/O Pins
CPU
– Up to 10 MIPS Throughput at 10 MHz
Peripheral Features