T/C: Timers/counters
The timers and counters provide all timing and counting
functions inside the microcontroller. The major operations
of this section are performed clock functions,
modulations, pulse generations, frequency measuring,
making oscillations, etc. This also can be used for
counting external pulses. A microcontroller may have
more than one timer and counters.
Parallel ports
provide various serial interfaces between a
microcontroller and other peripherals like
parallel ports
interrupts sources
Interrupts are the events that temporarily suspend
the main program and are provided by interrupts
sources
PWM function block
Is a built-in timer that can be used to generate
a PWM signal.
Pulse width modulation
A/D: analog to digital converter
are used for converting the analog signal to digital
form. The input signal in this converter should be in
analog form (e.g. sensor output) and the output from
this unit is in digital form. The digital output can be
used for various digital applications (e.g. measurement
devices)
D/A: digital to analog converter
perform reversal operation of ADC conversion
AVR Architecture
RISC (reduced instruction set computer) modified Harvard architecture:
The purpose of this architecture is to shorten the runtime by reducing the set
of commands on the computer. The use of RISC architecture also made it
possible to program in high-level languages such as C and BASIC
• Scalable
Same powerful AVR core in all components
• Single cycle execution
One instruction per external clock
• 32 Working Registers
All Directly connected to ALU!
• Very efficient core
Low power consumption
• High System Level Integration
Lowest total system cost
AVR
microcontroller
Architecture
AVR Harvard Architecture
Buses: there are separate buses for the code and
control and data memory
the address bus allows the CPU to send the address to other
components such as (RAM, I/P devices).(bidirectional)
The data bus carries the data between CPU and other
components. (unidirectional)
the control bus is the communication between address bus and
data bus
AT mega 32/16 features
4 input/output ports
T/C0 , T/C2 which are 8 bit and T/C1 is 16 bit
Parallel ports or Serial interface (TXD, RXD)
Interrupts T/C, A/D ;any function has its own interrupts
2 PMM generators OC1a, OC1b
8 A/D converter pins (bits) and AREF, AGND, AVCC
to omit the noise
ATmega16/32
Pin description:
4 ports A,B,C,D each has 8 pins.
RESET input. if a low level will be
on this pin for longer than the
minimum pulse length it will
generate a reset.
XTAL1 Input to the inverting
Oscillator amplifier and input to the
external clock operating circuit.
XTAL2 Output from the inverting
Oscillator amplifier.
AVCC is the supply voltage pin for
Port A and the A/D Converter. It
should be externally connected to
VCC.
AREF is the analog reference pin for
the A/D Converter.
Atmega 32/16 Clock sources
AVR clock sources can be either:
Internal Clock distribution
External
A clock used by related fuse bits
Internal clock source
Internal calibrated oscillator with the
frequency of 1, 2,4, 8 MHz which the
microcontroller as a default use the
frequency of 1MHz
Atmega 32/16 Clock sources
AVR external clock sources
external clock signal (22 MHz)
NC Extal 2
Extal1
Atmega 32/16 Clock sources
AVR external clock sources
external RC oscillator
min(C ) 22 pF VCC
NC
Extal 2
R
1
f Extal1
3RC
Atmega 32/16 Clock sources
AVR external clock sources
external crystal oscillator with frequency of which is
determined by quartz crystal (16 MHz)
30 pF
Extal 2
Extal1
30 pF
quartz crystal
external crystal oscillator with frequency of which
is determined by quartz crystal (32.768 kHz)