1 Introduction
1 Introduction
Topics
• AVR Features
• AVR members
3
• Microcontrollers
Microcontroller
I/O Serial
RAM ROM Timer
Port Port
CPU
Buses
4
• Microcontroller: ATmega328
• Operating Voltage: 5V
• Input Voltage : 7v to 12V
• 14 Digital I/O pins
• 6 Analog I/O pins
• Flash Memory is 32 KB
• SRAM is 2 KB
• EEPROM is 1 KB
• CLK Speed is 16 MHz
• DC Current for I/O pins is 40 mA
• DC Current for 3.3V Pin is 50 mA
5
AVR Types
• Classic AVR
• e.g. AT90S2313, AT90S4433
• Mega
• e.g. ATmega328, ATmega32, ATmega128
• Tiny
• e.g. ATtiny13, ATtiny25
• Special Purpose AVR
• e.g. AT90PWM216,AT90USB1287
• XMega
• New features like DMA, DAC, crypto engine, etc.
AVR internal architecture
PROGRAM
ROM
Program
Bus Bus
CPU
Interrupt Other
OSC Ports
Unit Peripherals
I/O
PINS
AVR’s CPU
• AVR’s CPU
• It’s an 8-bit Microcontroller
• ALU
R0
• Based on Harvard
R1
Architechture ALU
R2
• 32 General Purpose registers
…
(R0 to R31) SREG: I T H S V N Z C
• PC register R15
…
PC
8 bit
Data Address
Space R0
R1
$0000 R2
$0001 General
...
Purpose
...
Registers R31
$001F I/O Address
TWBR $00
$0020
TWSR $01
Standard I/O
...
...
Registers
SPH $3E
$005F SREG $3F
$0060
General
purpose
...
RAM
(SRAM)
$FFFF
AVR Ports
• ATmega32 ports are 8-bit SFRs
• Configurable as
• Input Port
• Output Port
• Alternate Function
Port Register Functions
• Port has 3 registers (8-Bit each)
• PORTx (Output Data)
• DDRx (Direction of Data)
• PINx (Input Data)
Port Internal Structure
Upon reset, all ports have the value 0x00 in their DDR
registers. This means that all ports are configured as input
Alternate functions of Port A and Port B
Alternate functions of Port C and Port D