Professional Documents
Culture Documents
Using ATmega16
Everything is Embedded
2/15/16
2/15/16
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"
Harvard Architecture
Howard Hathaway Aiken
2/15/16
Provides a pathway between the instruction memory (such as ROM or flash) and the CPU to
allow words from the instruction memory to be treated as read-only data. This technique is
used in some microcontrollers, including the Atmel AVR. This allows constant data, such as
text strings or function tables, to be accessed without first having to be copied into data
memory, preserving scarce (and power-hungry) data memory for read/write variables.
Special machine language instructions are provided to read data from the instruction
memory. (This is distinct from instructions which themselves embed constant data, although
for individual constants the two mechanisms can substitute for each other.)
2/15/16
RISC
Emphasis on hardware
Emphasis on software
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.
But even though RISC has been in the market since 1980, it hasnt 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.
2/15/16
Classic AVR
e.g. AT90S2313, AT90S4433
Mega
e.g. ATmega8, ATmega32, ATmega128
Tiny
e.g. ATtiny13, ATtiny25
2/15/16
ATtiny44
Atmel
2/15/16
Tiny
group
Flash =4K
Flash
=128K
AT90S4433
Atmel Class
ic
grou
p
Flash =4K
Clears
PortallB
theProvides
registers
and restart
supply
voltage
These
pins
areIt
the
to the
chip.
used
tobe
execution
of
should
connect to
program
connected
external+5
crystal
or RC oscillator
Port D
2/15/16
Port A
Reference
voltage
ADC
Supplyfor
voltage
for ADC and
portA. Connect
it to VCC
Port C
2/15/16
2/15/16
2/15/16
2KB SRAM
For temporary data storage
Memory is lost when power is shut off (volatile)
2.
1KB EEPROM
For persistent data storage
Memory contents are retained when power is off (non-volatile)
Fast read; slow write
3. 32KB Flash Program Memory
Used to store program code
Memory contents retained when power is off (non-volatile)
Fast to read; slow to write
Can only write entire blocks of memory at a time
organized in 16-bit words (16KWords)
2/15/16
Flash
RAM
EEPROM
F_END
Size, kB
RAMEND
Size, kB
E_END
Size, kB
Atmega8
$0FFF
$045F
$1FF
0.5
Atmega32
$3FFF
32
$085F
$3FF
Atmega64
$7FFF
64
$10FF
$7FF
Atmega12
8
$FFFF
128
$10FF
$FFF
2/15/16
Memory Architecture of
ATmega32
2/15/16
Chip
Bytes
Chip
Bytes
Chip
Bytes
ATmega8
512
ATmega16
512
ATmega32
1024
ATmega64
2048
ATmega128
4096
ATmega256R 4096
Z
ATmega640
4096
ATmega1280
4096
ATmega2560 4096
2/15/16
2/15/16
2/15/16
2/15/16
2/15/16
AVR family
Classic
Mega
Tiny
Special purpose.
AVR family
Classic AVR (AT90Sxxxx)
This is the original AVR chip, which has
been replaced by newer AVR chips and
are not recommended for new designs.
AVR family
AVR family
AVR family
AVR FEATURES
AVR CPU/ALU
ATmega32 Status
Register
ATmega16 Pin
configuration
ATmega32 Pin
configuration
PORTA
PORTB
PORTC
PORTD
1.
2.
Pin direction
Logic 1 for output
Logic 0 for input
DDRA=0b01001111 what
Answer
PA0 this pin is output
PA1 this pin is output
PA2 this pin is output
PA3 this pin is output
PA4 this pin is input
PA5 this pin is input
PA6 this pin is output
PA7 this pin is input
is this
PORTA=0b01001111 what
is this
Answer
PA0 the voltage on this pin is 5V
PA1 the voltage on this pin is 5V
PA2 the voltage on this pin is 5V
PA3 the voltage on this pin is 5V
PA4 the voltage on this pin is 0V
PA5 the voltage on this pin is 0V
PA6 the voltage on this pin is 5V
PA7 the voltage on this pin is 0V
Amazing!!!