SlideShare a Scribd company logo
Introduction to AVR Microcontroller
by:
Eng. Mohamed Tarek.
© 2014 by Eng. Mohamed Tarek. 1
Micro-controller vs. Micro-processor
 Micro-controller
• Basically a microcontroller can be described as
a computer on a chip. a single chip containing
a CPU, non-volatile memory (RAM), volatile
memory(ROM), a timer and an I/O control unit.
• A microcontroller apart from the above mentioned
components usually also include serial
communication capabilities, interrupt controls and
analog I/O capabilities.
• Used for a few dedicated functions determined by
the system designer.
© 2014 by Eng. Mohamed Tarek. 2
Micro-controller vs. Micro-processor
Many IC’s into one IC
© 2014 by Eng. Mohamed Tarek. 3
Micro-controller vs. Micro-processor
 Microcontrollers don’t work alone in the circuit it must
interfaces with other on chip devices like Sensors,
Switches, Leds, LCD, Keypad and DC Motor
 Microcontroller can accept inputs from some
components and provide outputs to other components
within any given system.
 Differences in requirements, make the manufacturers
produce different microcontrollers with different
memory sizes, number of I/O lines and number of
integrated peripheral devices. Other wise they are all
similar to use.
© 2014 by Eng. Mohamed Tarek. 4
Micro-controller vs. Micro-processor
© 2014 by Eng. Mohamed Tarek. 5
Micro-controller vs. Micro-processor
 Micro-processor
• Just a CPU has to add externally memory, clock,
input/output interfaces, timer and all other
needed peripheral. This is the reason
a microprocessor has so many pins.
• The difference between a microcontroller and
a microprocessor is that the microprocessor is
a general purpose computer while a microcontroller
is a computer dedicated to one or just a few tasks.
© 2014 by Eng. Mohamed Tarek. 6
Micro-controller vs. Micro-processor
© 2014 by Eng. Mohamed Tarek. 7
Micro-Controller Components
 Processor:
The processor refers to the Central Processing Unit (CPU) of the
microcontroller. It contains the Arithmetic Logic Unit (ALU), Control
Unit, Instruction Decoder and some Special Registers (Stack
Pointer, Status Register, Program Counter, etc.).
 Volatile Memory(RAM):
This is memory used by the microcontroller for temporary data
storage, system setup and peripherals configurations. Memory in
this category includes SRAM and DRAM. AVR microcontrollers
utilize SRAM.
 Non-Volatile Memory:
This is memory used by the microcontroller to store programs. Data
can also be stored in this memory but the access time is much
slower than that of RAM. Memory in this category includes ROM,
PROM, EPROM, EEPROM and FLASH. The AVR microcontrollers
utilize Flash for program storage, some AVR controllers contains a
bit of EEPROM as well.
© 2014 by Eng. Mohamed Tarek. 8
Micro-Controller Components(Cont.)
 Timer Module:
Most microcontrollers have at least one timer/counter peripheral.
Timer/Counter modules are used to perform timing or counting
operations in the controller. These include time stamping, measuring
intervals, counting events, etc.
 Interrupt Module:
Interrupts enable the microcontroller to monitor certain events in the
background while executing and application program and react to
the event if necessary pausing the original program. This is all
coordinated by the interrupt module.
 Digital I/O Module:
This module allows digital/logic communication with the
microcontroller and the external world. Communication signals are
that of TTL or CMOS logic.
© 2014 by Eng. Mohamed Tarek. 9
Micro-Controller Components(Cont.)
 Analog I/O Modules:
These modules are use to input/output analog information from/to
the external world. Analog modules include Analog Comparators
and Analog-to-Digital Converters.
 Serial Modules:
These modules are used for serial communication with the external
world. An example is the USART peripheral which utilizes the
RS232 standard.
© 2014 by Eng. Mohamed Tarek. 10
Manufacturers of Micro-controllers
 Atmel Corp. :
Manufacturers of the popular AVR series of microcontrollers.
 Microchip Technology Inc. :
Manufacturers of the PIC series of microcontrollers.
 Texas Instruments Inc. :
One of the world's largest semiconductor companies..
 Renesas Technology Corp. :
A joint merger of Hitachi and Mitsubishi product lines.
 Motorola company:
Manufacturers of the FreeScale series of microcontrollers
© 2014 by Eng. Mohamed Tarek. 11
AVR History
 AVR was developed in the year 1996 by Atmel
Corporation.
 The architecture of AVR was developed by Alf-Egil
Bogen and Vegard Wollan.
 AVR derives its name from its developers and stands for
Alf-Egil Bogen Vegard Wollan RISC microcontroller.
 Also known as Advanced Virtual RISC.
 The first microcontroller to hit the commercial market
was AT90S1200 in the year 1997.
© 2014 by Eng. Mohamed Tarek. 12
AVR Micro-controllers Categories
 1.TinyAVR :
• Less memory
• small size
• suitable only for simpler applications.
© 2014 by Eng. Mohamed Tarek. 13
AVR Micro-controllers Categories(Cont.)
 2.MegaAVR :
• These are the most popular ones.
• having good amount of memory (up to 256 KB) higher
number of inbuilt peripherals
• suitable for moderate to complex applications.
© 2014 by Eng. Mohamed Tarek. 14
AVR Micro-controllers Categories(Cont.)
 3.XmegaAVR :
• Used commercially for complex applications, which
require large program memory and high speed.
© 2014 by Eng. Mohamed Tarek. 15
AVR Micro-controllers Categories(Cont.)
© 2014 by Eng. Mohamed Tarek. 16
AVR Micro-controllers Categories(Cont.)
© 2014 by Eng. Mohamed Tarek. 17
What’s special about AVR? (Cont.)
 AVR micro-controllers are fast executes most of the
instructions in single execution cycle.
 AVRs are about 4 times faster than PICs.
 They consume less power and can be operated in
different power saving modes.
 Free IDE.
 Available in Egyptian market.
© 2014 by Eng. Mohamed Tarek. 18
What’s special about AVR? (Cont.)
 comparison between the three most commonly used
families of microcontrollers:
© 2014 by Eng. Mohamed Tarek. 19
What’s special about AVR? (Cont.)
© 2014 by Eng. Mohamed Tarek. 20
What’s special about AVR? (Cont.)
 8-bit Micro-controllers
© 2014 by Eng. Mohamed Tarek. 21
What’s special about AVR?(Cont.)
 AVR follows Harvard Architecture
• the processor is equipped with separate memories and buses for
Program and the Data information. Here while an instruction is
being executed, the next instruction is pre-fetched from the
program memory.
© 2014 by Eng. Mohamed Tarek. 22
Atmega16
 Naming Convention
© 2014 by Eng. Mohamed Tarek. 23
Flavors of Atmega16
 There are two flavors for Atmega16 microcontroller:
1. Atmega16: Operating frequency range is 0 – 16 MHz.
2. Atmega16L: Operating frequency range is 0 – 8 MHz.
If we are using a crystal of 8 MHz = 8 x 106 Hertz =
8 Million cycles, then AVR can execute 8 million
instructions.
© 2014 by Eng. Mohamed Tarek. 24
Atmega16 Architecture
© 2014 by Eng. Mohamed Tarek. 25
Atmega16 Architecture(Cont.)
 General Purpose Registers:
Atmega16 is equipped with 32 general purpose registers
which are coupled directly with the Arithmetic Logical
Unit (ALU) of CPU.
 I/O Ports:
Atmega16 has four (PORTA, PORTB, PORTC and
PORTD) 8-bit input-output ports.
 ADC Interface:
Atmega16 is equipped with an 8 channel ADC with a
resolution of 10-bits.
© 2014 by Eng. Mohamed Tarek. 26
Atmega16 Architecture(Cont.)
 Timers/Counters:
Atmega16 consists of two 8-bit and one 16-bit
timer/counter.
 Watchdog Timer:
present with internal oscillator. Watchdog timer
continuously monitors and resets the controller if the
code gets stuck at any execution action for more than a
defined time interval.
 Interrupt:
consists of 21 interrupt sources out of which four are
external. The remaining are internal interrupts which
support the peripherals like USART, ADC, Timers etc.
© 2014 by Eng. Mohamed Tarek. 27
Atmega16 Architecture(Cont.)
 USART:
Universal Synchronous and Asynchronous Receiver
and Transmitter interface is available for interfacing
with external device capable of communicating serially
(data transmission bit by bit).
 SPI:
Serial Peripheral interface port is used for serial
communication between two devices on a common clock
source.
 ISP(In System Programmable ):
Flash Memory which can be programmed without
removing the IC from the circuit.
© 2014 by Eng. Mohamed Tarek. 28
Atmega16 Architecture(Cont.)
 Internal Calibrated Oscillator:
• Atmega16 is equipped with an internal oscillator for
driving its clock. By default Atmega16 is set to
operate at internal calibrated oscillator of 1 Mhz.
• The maximum frequency of internal oscillator is 8Mhz.
• ATmega16 can be operated using an external crystal
oscillator with a maximum frequency of 16MHz
© 2014 by Eng. Mohamed Tarek. 29
Atmega16 Architecture(Cont.)
 Memory: Atmega16 consist of three different
memory sections:
• Program flash EEPROM memory: Atmega16 is
available with 16KB of in system programmable Flash
EEPROM.
• Byte Addressable EEPROM: Atmega16 has 512
bytes of EEPROM.
• SRAM(data memory) :Atmega16 is equipped with
1KB of internal SRAM.
Note: A small portion of SRAM is set aside for general
purpose registers used by CPU and some for the
peripheral subsystems of the microcontroller.
© 2014 by Eng. Mohamed Tarek. 30
Atmega16 pins
© 2014 by Eng. Mohamed Tarek. 31
Atmega16 pins
© 2014 by Eng. Mohamed Tarek. 32
Atmega16 pins
© 2014 by Eng. Mohamed Tarek. 33
Atmega16 pins
© 2014 by Eng. Mohamed Tarek. 34
Active Low Reset circuit
R= 4.7KΩ
C= 0.1µf or 100nf
© 2014 by Eng. Mohamed Tarek. 35
Internal Calibrated RC Oscillator
© 2014 by Eng. Mohamed Tarek. 36
External Crystal Oscillator
C1 = C2 = 22pf
© 2014 by Eng. Mohamed Tarek. 37
External Crystal Oscillator(Cont.)
© 2014 by Eng. Mohamed Tarek. 38
External Crystal Oscillator(Cont.)
 Example: configure the µC to deal with 16Mhz Crystal
• CKSEL3  1
• CKSEL2  1
• CKSEL1  1
• CKSEL0  1
• CKOPT  0
© 2014 by Eng. Mohamed Tarek. 39
How to program AVR Microcontroller using ISP
© 2014 by Eng. Mohamed Tarek. 40
© 2014 by Eng. Mohamed Tarek. 41
Contact Details
Eng. Mohamed Tarek.
Embedded Software Engineer
Tel: 01115154316
mtarek.2013@gmail.com
© 2014 by Eng. Mohamed Tarek. 42

More Related Content

PPTX
PIC Microcontroller | ADC Interfacing
PPTX
ARM Processor
PPTX
Obstacle avoiding robot
PPTX
Arduino Based Parking Lot System
PPTX
Introduction to Embedded Systems I : Chapter 1
PPTX
Smart Intelligent trolley
PDF
Gesture control car
PPSX
Lect 3 ARM PROCESSOR ARCHITECTURE
PIC Microcontroller | ADC Interfacing
ARM Processor
Obstacle avoiding robot
Arduino Based Parking Lot System
Introduction to Embedded Systems I : Chapter 1
Smart Intelligent trolley
Gesture control car
Lect 3 ARM PROCESSOR ARCHITECTURE

What's hot (20)

PPTX
Module 1 notes for IoT BETCK105H (VTU) Introduction to IoT
PPTX
HUMAN FOLLOWING ROBOT
DOC
Obstacle avoiding robot(Lab report)
PPT
Sensors and Actuators
PPTX
MODEL TRAIN CONTROLLER.pptx
PPSX
System on chip architectures
PPT
Rs232 485 fundamental
DOCX
Traffic light controller
DOCX
Training report on embedded sys_AVR
DOCX
4 Way traffic controll new
PPT
microprocessor architecture
PPTX
Vehicle Speed detecter By PRAGYA AGARWAL
PDF
System-on-Chip Design, Embedded System Design Challenges
PPTX
Microwave measurement
PDF
Industrial Automation
PPTX
Gesture control car
PPT
Embedded systems and their applications in our daily routine
PPTX
automatic Rain sensing windshield wiper ppt
PPTX
Serial buses
Module 1 notes for IoT BETCK105H (VTU) Introduction to IoT
HUMAN FOLLOWING ROBOT
Obstacle avoiding robot(Lab report)
Sensors and Actuators
MODEL TRAIN CONTROLLER.pptx
System on chip architectures
Rs232 485 fundamental
Traffic light controller
Training report on embedded sys_AVR
4 Way traffic controll new
microprocessor architecture
Vehicle Speed detecter By PRAGYA AGARWAL
System-on-Chip Design, Embedded System Design Challenges
Microwave measurement
Industrial Automation
Gesture control car
Embedded systems and their applications in our daily routine
automatic Rain sensing windshield wiper ppt
Serial buses
Ad

Similar to 1.Introduction to AVR.pdf (20)

PDF
Introduction to Avr Microcontrollers
PPTX
Intro to micro controller (Atmega16)
PPTX
3.TechieNest microcontrollers
PDF
introduction to embedded systems part 2
PDF
Micro controller
PPTX
ATmega 16
PDF
The document provides an overview of the Arduino platform for beginners.
PPTX
1. Microcontroller Basics ENTC department.pptx
PDF
Microcontroller
PPTX
Overview of Microcontroller and ATMega32 microcontroller
PPTX
ATmega32-AVR microcontrollers-Part I
PPTX
Atmega16
PDF
AVR_Course_Day4 introduction to microcontroller
PPTX
Tutorial on avr atmega8 microcontroller, architecture and its applications
PPTX
Introduction to AVR Microcontroller
PPT
Avr introduction
PPT
Avr microcontrollers training (sahil gupta - 9068557926)
PPTX
BRACU_SPRING24_EEE373_L1_Introduction.pptx
PPT
Chapter12
PPT
Developing an avr microcontroller system
Introduction to Avr Microcontrollers
Intro to micro controller (Atmega16)
3.TechieNest microcontrollers
introduction to embedded systems part 2
Micro controller
ATmega 16
The document provides an overview of the Arduino platform for beginners.
1. Microcontroller Basics ENTC department.pptx
Microcontroller
Overview of Microcontroller and ATMega32 microcontroller
ATmega32-AVR microcontrollers-Part I
Atmega16
AVR_Course_Day4 introduction to microcontroller
Tutorial on avr atmega8 microcontroller, architecture and its applications
Introduction to AVR Microcontroller
Avr introduction
Avr microcontrollers training (sahil gupta - 9068557926)
BRACU_SPRING24_EEE373_L1_Introduction.pptx
Chapter12
Developing an avr microcontroller system
Ad

More from MostafaKhaled78 (11)

PDF
Smarter-Solutions---MCA-Tool-note---February-2017 (1).pdf
PDF
Smarter-Solutions---MCA-Tool-note---February-2017.pdf
DOCX
Risk Assessment with Monte Carlo Simulation to Improve Bridge Construction Sa...
DOCX
Scenario analysisAdapting SWIFT for the Healthcare Sector .docx
PPTX
the_evolution_of_space_exploration_.pptx
PPTX
how_artificial_intelligence_is_transforming_healthcare.pptx
PPTX
the_future_of_renewable_energy_Educate.pptx
PPTX
minimalist_lifestyle__benefits_and_challenges.pptx
PPTX
PrqjnasncjnACANZIDJNCWJNCesentationtitleaqzqwsxjcahbacsjcbaScjbCJKFsacjghvKga...
PPTX
Labqazwsxedcrfvtgbyhnujmqazwsxedcrfvtgbyhnujmqazwsx.pptx
PPTX
technical report presents a comprehensive study. .pptx
Smarter-Solutions---MCA-Tool-note---February-2017 (1).pdf
Smarter-Solutions---MCA-Tool-note---February-2017.pdf
Risk Assessment with Monte Carlo Simulation to Improve Bridge Construction Sa...
Scenario analysisAdapting SWIFT for the Healthcare Sector .docx
the_evolution_of_space_exploration_.pptx
how_artificial_intelligence_is_transforming_healthcare.pptx
the_future_of_renewable_energy_Educate.pptx
minimalist_lifestyle__benefits_and_challenges.pptx
PrqjnasncjnACANZIDJNCWJNCesentationtitleaqzqwsxjcahbacsjcbaScjbCJKFsacjghvKga...
Labqazwsxedcrfvtgbyhnujmqazwsxedcrfvtgbyhnujmqazwsx.pptx
technical report presents a comprehensive study. .pptx

Recently uploaded (20)

PPT
Project quality management in manufacturing
DOCX
573137875-Attendance-Management-System-original
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPT
introduction to datamining and warehousing
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Geodesy 1.pptx...............................................
PDF
Well-logging-methods_new................
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PPTX
OOP with Java - Java Introduction (Basics)
Project quality management in manufacturing
573137875-Attendance-Management-System-original
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
UNIT 4 Total Quality Management .pptx
Internet of Things (IOT) - A guide to understanding
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
bas. eng. economics group 4 presentation 1.pptx
Mechanical Engineering MATERIALS Selection
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
introduction to datamining and warehousing
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Geodesy 1.pptx...............................................
Well-logging-methods_new................
Embodied AI: Ushering in the Next Era of Intelligent Systems
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
OOP with Java - Java Introduction (Basics)

1.Introduction to AVR.pdf

  • 1. Introduction to AVR Microcontroller by: Eng. Mohamed Tarek. © 2014 by Eng. Mohamed Tarek. 1
  • 2. Micro-controller vs. Micro-processor  Micro-controller • Basically a microcontroller can be described as a computer on a chip. a single chip containing a CPU, non-volatile memory (RAM), volatile memory(ROM), a timer and an I/O control unit. • A microcontroller apart from the above mentioned components usually also include serial communication capabilities, interrupt controls and analog I/O capabilities. • Used for a few dedicated functions determined by the system designer. © 2014 by Eng. Mohamed Tarek. 2
  • 3. Micro-controller vs. Micro-processor Many IC’s into one IC © 2014 by Eng. Mohamed Tarek. 3
  • 4. Micro-controller vs. Micro-processor  Microcontrollers don’t work alone in the circuit it must interfaces with other on chip devices like Sensors, Switches, Leds, LCD, Keypad and DC Motor  Microcontroller can accept inputs from some components and provide outputs to other components within any given system.  Differences in requirements, make the manufacturers produce different microcontrollers with different memory sizes, number of I/O lines and number of integrated peripheral devices. Other wise they are all similar to use. © 2014 by Eng. Mohamed Tarek. 4
  • 5. Micro-controller vs. Micro-processor © 2014 by Eng. Mohamed Tarek. 5
  • 6. Micro-controller vs. Micro-processor  Micro-processor • Just a CPU has to add externally memory, clock, input/output interfaces, timer and all other needed peripheral. This is the reason a microprocessor has so many pins. • The difference between a microcontroller and a microprocessor is that the microprocessor is a general purpose computer while a microcontroller is a computer dedicated to one or just a few tasks. © 2014 by Eng. Mohamed Tarek. 6
  • 7. Micro-controller vs. Micro-processor © 2014 by Eng. Mohamed Tarek. 7
  • 8. Micro-Controller Components  Processor: The processor refers to the Central Processing Unit (CPU) of the microcontroller. It contains the Arithmetic Logic Unit (ALU), Control Unit, Instruction Decoder and some Special Registers (Stack Pointer, Status Register, Program Counter, etc.).  Volatile Memory(RAM): This is memory used by the microcontroller for temporary data storage, system setup and peripherals configurations. Memory in this category includes SRAM and DRAM. AVR microcontrollers utilize SRAM.  Non-Volatile Memory: This is memory used by the microcontroller to store programs. Data can also be stored in this memory but the access time is much slower than that of RAM. Memory in this category includes ROM, PROM, EPROM, EEPROM and FLASH. The AVR microcontrollers utilize Flash for program storage, some AVR controllers contains a bit of EEPROM as well. © 2014 by Eng. Mohamed Tarek. 8
  • 9. Micro-Controller Components(Cont.)  Timer Module: Most microcontrollers have at least one timer/counter peripheral. Timer/Counter modules are used to perform timing or counting operations in the controller. These include time stamping, measuring intervals, counting events, etc.  Interrupt Module: Interrupts enable the microcontroller to monitor certain events in the background while executing and application program and react to the event if necessary pausing the original program. This is all coordinated by the interrupt module.  Digital I/O Module: This module allows digital/logic communication with the microcontroller and the external world. Communication signals are that of TTL or CMOS logic. © 2014 by Eng. Mohamed Tarek. 9
  • 10. Micro-Controller Components(Cont.)  Analog I/O Modules: These modules are use to input/output analog information from/to the external world. Analog modules include Analog Comparators and Analog-to-Digital Converters.  Serial Modules: These modules are used for serial communication with the external world. An example is the USART peripheral which utilizes the RS232 standard. © 2014 by Eng. Mohamed Tarek. 10
  • 11. Manufacturers of Micro-controllers  Atmel Corp. : Manufacturers of the popular AVR series of microcontrollers.  Microchip Technology Inc. : Manufacturers of the PIC series of microcontrollers.  Texas Instruments Inc. : One of the world's largest semiconductor companies..  Renesas Technology Corp. : A joint merger of Hitachi and Mitsubishi product lines.  Motorola company: Manufacturers of the FreeScale series of microcontrollers © 2014 by Eng. Mohamed Tarek. 11
  • 12. AVR History  AVR was developed in the year 1996 by Atmel Corporation.  The architecture of AVR was developed by Alf-Egil Bogen and Vegard Wollan.  AVR derives its name from its developers and stands for Alf-Egil Bogen Vegard Wollan RISC microcontroller.  Also known as Advanced Virtual RISC.  The first microcontroller to hit the commercial market was AT90S1200 in the year 1997. © 2014 by Eng. Mohamed Tarek. 12
  • 13. AVR Micro-controllers Categories  1.TinyAVR : • Less memory • small size • suitable only for simpler applications. © 2014 by Eng. Mohamed Tarek. 13
  • 14. AVR Micro-controllers Categories(Cont.)  2.MegaAVR : • These are the most popular ones. • having good amount of memory (up to 256 KB) higher number of inbuilt peripherals • suitable for moderate to complex applications. © 2014 by Eng. Mohamed Tarek. 14
  • 15. AVR Micro-controllers Categories(Cont.)  3.XmegaAVR : • Used commercially for complex applications, which require large program memory and high speed. © 2014 by Eng. Mohamed Tarek. 15
  • 16. AVR Micro-controllers Categories(Cont.) © 2014 by Eng. Mohamed Tarek. 16
  • 17. AVR Micro-controllers Categories(Cont.) © 2014 by Eng. Mohamed Tarek. 17
  • 18. What’s special about AVR? (Cont.)  AVR micro-controllers are fast executes most of the instructions in single execution cycle.  AVRs are about 4 times faster than PICs.  They consume less power and can be operated in different power saving modes.  Free IDE.  Available in Egyptian market. © 2014 by Eng. Mohamed Tarek. 18
  • 19. What’s special about AVR? (Cont.)  comparison between the three most commonly used families of microcontrollers: © 2014 by Eng. Mohamed Tarek. 19
  • 20. What’s special about AVR? (Cont.) © 2014 by Eng. Mohamed Tarek. 20
  • 21. What’s special about AVR? (Cont.)  8-bit Micro-controllers © 2014 by Eng. Mohamed Tarek. 21
  • 22. What’s special about AVR?(Cont.)  AVR follows Harvard Architecture • the processor is equipped with separate memories and buses for Program and the Data information. Here while an instruction is being executed, the next instruction is pre-fetched from the program memory. © 2014 by Eng. Mohamed Tarek. 22
  • 23. Atmega16  Naming Convention © 2014 by Eng. Mohamed Tarek. 23
  • 24. Flavors of Atmega16  There are two flavors for Atmega16 microcontroller: 1. Atmega16: Operating frequency range is 0 – 16 MHz. 2. Atmega16L: Operating frequency range is 0 – 8 MHz. If we are using a crystal of 8 MHz = 8 x 106 Hertz = 8 Million cycles, then AVR can execute 8 million instructions. © 2014 by Eng. Mohamed Tarek. 24
  • 25. Atmega16 Architecture © 2014 by Eng. Mohamed Tarek. 25
  • 26. Atmega16 Architecture(Cont.)  General Purpose Registers: Atmega16 is equipped with 32 general purpose registers which are coupled directly with the Arithmetic Logical Unit (ALU) of CPU.  I/O Ports: Atmega16 has four (PORTA, PORTB, PORTC and PORTD) 8-bit input-output ports.  ADC Interface: Atmega16 is equipped with an 8 channel ADC with a resolution of 10-bits. © 2014 by Eng. Mohamed Tarek. 26
  • 27. Atmega16 Architecture(Cont.)  Timers/Counters: Atmega16 consists of two 8-bit and one 16-bit timer/counter.  Watchdog Timer: present with internal oscillator. Watchdog timer continuously monitors and resets the controller if the code gets stuck at any execution action for more than a defined time interval.  Interrupt: consists of 21 interrupt sources out of which four are external. The remaining are internal interrupts which support the peripherals like USART, ADC, Timers etc. © 2014 by Eng. Mohamed Tarek. 27
  • 28. Atmega16 Architecture(Cont.)  USART: Universal Synchronous and Asynchronous Receiver and Transmitter interface is available for interfacing with external device capable of communicating serially (data transmission bit by bit).  SPI: Serial Peripheral interface port is used for serial communication between two devices on a common clock source.  ISP(In System Programmable ): Flash Memory which can be programmed without removing the IC from the circuit. © 2014 by Eng. Mohamed Tarek. 28
  • 29. Atmega16 Architecture(Cont.)  Internal Calibrated Oscillator: • Atmega16 is equipped with an internal oscillator for driving its clock. By default Atmega16 is set to operate at internal calibrated oscillator of 1 Mhz. • The maximum frequency of internal oscillator is 8Mhz. • ATmega16 can be operated using an external crystal oscillator with a maximum frequency of 16MHz © 2014 by Eng. Mohamed Tarek. 29
  • 30. Atmega16 Architecture(Cont.)  Memory: Atmega16 consist of three different memory sections: • Program flash EEPROM memory: Atmega16 is available with 16KB of in system programmable Flash EEPROM. • Byte Addressable EEPROM: Atmega16 has 512 bytes of EEPROM. • SRAM(data memory) :Atmega16 is equipped with 1KB of internal SRAM. Note: A small portion of SRAM is set aside for general purpose registers used by CPU and some for the peripheral subsystems of the microcontroller. © 2014 by Eng. Mohamed Tarek. 30
  • 31. Atmega16 pins © 2014 by Eng. Mohamed Tarek. 31
  • 32. Atmega16 pins © 2014 by Eng. Mohamed Tarek. 32
  • 33. Atmega16 pins © 2014 by Eng. Mohamed Tarek. 33
  • 34. Atmega16 pins © 2014 by Eng. Mohamed Tarek. 34
  • 35. Active Low Reset circuit R= 4.7KΩ C= 0.1µf or 100nf © 2014 by Eng. Mohamed Tarek. 35
  • 36. Internal Calibrated RC Oscillator © 2014 by Eng. Mohamed Tarek. 36
  • 37. External Crystal Oscillator C1 = C2 = 22pf © 2014 by Eng. Mohamed Tarek. 37
  • 38. External Crystal Oscillator(Cont.) © 2014 by Eng. Mohamed Tarek. 38
  • 39. External Crystal Oscillator(Cont.)  Example: configure the µC to deal with 16Mhz Crystal • CKSEL3  1 • CKSEL2  1 • CKSEL1  1 • CKSEL0  1 • CKOPT  0 © 2014 by Eng. Mohamed Tarek. 39
  • 40. How to program AVR Microcontroller using ISP © 2014 by Eng. Mohamed Tarek. 40
  • 41. © 2014 by Eng. Mohamed Tarek. 41
  • 42. Contact Details Eng. Mohamed Tarek. Embedded Software Engineer Tel: 01115154316 mtarek.2013@gmail.com © 2014 by Eng. Mohamed Tarek. 42