Module 2 AVR ATMega32 Architecture
Module 2 AVR ATMega32 Architecture
Introduction to
AVR ATMega32
Architecture
Plastic
Chip case
Pins
Processor Architecture &
Organization
Architecture
attributes of a system visible to a
programmer
these attributes have a direct impact on
the logical execution of a program
Instruction set, number of bits used for
data representation, I/O mechanisms,
addressing techniques
Design issue: whether a computer will
have a specific instruction.
e.g. Is there a multiply instruction?
20112012-I Module 2/2
Processor Architecture &
Organization
Organization
the operational units and their
interconnections that realize the
architectural specifications
(how features are implemented)
hardware details that are transparent to
the programmers
Control signals, interfaces, memory
technology
Design issue: how this instruction is to be
implemented.
Is there a hardware multiply unit or is it
done by repeated
20112012-I
addition? Module 2/3
Processor Architecture &
Organization
Many computer manufacturers offer a family of
computer models, all with the same
architecture but with differences in
organization.
This gives code compatibility (at least backwards)
All Intel x86 family share the same basic
architecture
The IBM System/370 family share the same
basic architecture
An architecture may survive many years, but its
organization changes with the changing
technology.
E.g. the IBM Systems/370
20112012-I architecture, with few
Module 2/4
Introduction to Atmel AVR
Atmel Corporation is a manufacturer of
semiconductors, founded in 1984.
Harvard architecture
Code Data
Memory Memory
Data bus
CPU Address bus
Control bus
Classic AVR
e.g. AT90S2313, AT90S4433
Mega
e.g. ATmega8, ATmega32, ATmega128
Tiny
e.g. ATtiny13, ATtiny25
Special Purpose AVR
e.g. AT90PWM216,AT90USB1287
Lets get familiar with the AVR part
numbers
ATmega128
Atmel group
Flash
=128K
ATtiny44 AT90S4433
Atmel
Tiny Flash =4K Atmel Classi
Flash =4K
group c
group
Clears all B
Port
the
Provides
Port A
registers
supply voltage Reference
These
and
to pins
the areIt
restart
chip. voltagevoltage
for
Supply
used
thetobe
should forADC
ADC and
connect ofto
execution
connected portA.
external
program
+5 Connect it to
crystal or RC
VCC
oscillator
Port C
Port D
2. 1KB EEPROM
For persistent data storage
Memory contents are
retained when power is off
(non-volatile)
Fast read; slow write
Can write individual bytes
Special Function
Registers (SFRs),
and
Internal data
SRAM.
SREG: Solution:
I T H S V N Z C
Solution:
Solution:
CPU
Solution:
Solution: R15
11
$52
$9C
$A5 0101 0010
10011100
1010 1100 R16
0101
$9C
$38
- 1001
0011
$73 1000
0111 0011
-- +$64
+ $9C
$23
$2F 10010100
0010
0110
0010 1100
R17
0011
1111
$DF
$00
$82 1101
0000
1000 1111R20
0000
0010 =R20
$DF== $82
R20 $00= 00
PC
$100
C = 1 because 1
$67 R21 0000
0110 0111 thanR20
0000
is bigger R20=
R16 0x67
and there is a borrow from D8 bit.
CCC===100because
becausethere
because R21 is
R21 is not
isnot
ahas bigger
bigger
carry than R20
than
beyond R20 andbit.
and
thethan
D7 there is
there is no
no borrow
borrow from
from D8
D8 bit.
bit.
Z
C = 0 because the R20 a value other zero after the subtraction.
H
Instruction ==
ZZ ==100 because
1decoder
because
because
there
because there
the R20
the R20 is has
is
nozero
carry
aaisR30
beyond
after
a value
carry from
the
the D3
other
the
D70 bit.
subtraction.
than theafter
toD3. the subtraction.
D4 bit.
H
H =
= 1
1 because
because there
there is
is a borrow
carry
R31 from
from D4
the D3 to to the D4 bit.
ZHH===100because
becausethe
because there
there
R20 is(the
is no
no borrow
borrow fromaD4
result) from
has D4 to D3.
to
value D3.
0 in it after the addition.
Z = 0 because
Instruction Register the R16 (the result) has a value other than 0 after the addition.
registers