SlideShare una empresa de Scribd logo
1 de 11
Descargar para leer sin conexión
Understanding Atmega328P Microcontroller
(Lecture-9)
R S Ananda Murthy
Associate Professor and Head
Department of Electrical & Electronics Engineering,
Sri Jayachamarajendra College of Engineering,
Mysore 570 006
R S Ananda Murthy Understanding Atmega328P Microcontroller
AVR CPU General Purpose Registers – 32×8
R0
D0D1D2. . . . . . . . . . . .D7
R1
R2
...
R13
R14
R15
0x00
0x01
0x02
0x0D
0x0E
0x0F
Addr.
R16
R17
...
0x10
0x11
R26
R27
R28
0x1A
0x1B
0x1C
R29
R30
0x1D
0x1E
R31 0x1F
......
X Register Low-byte
X Register High-byte
Y Register Low-byte
Y Register High-byte
Z Register Low-byte
Z Register High-byte
Most instructions can access
any register and complete
operation in one CPU clock cycle.
There is also a 16-bit Stack Pointer.
Last three register pairs given below
can be used as three 16-bit index
registers to point at data memory.
R S Ananda Murthy Understanding Atmega328P Microcontroller
X, Y, and Z Registers – 16-bit Pointers to Data
D0D1D2. . . . . . . . . .D7
R26 (0x1A)R27 (0x1B)
D0D1D2. . . . . . . . . .D7
015 XH XL
X-Register
D0D1D2. . . . . . . . . .D7
R28 (0x1C)R29 (0x1D)
D0D1D2. . . . . . . . . .D7
015 YH YL
Y-Register
D0D1D2. . . . . . . . . .D7
R30 (0x1E)R31 (0x1F)
D0D1D2. . . . . . . . . .D7
015 ZH ZL
Z-Register
Register pairs R27 and R26, R29 and R28, R31 and R30
known as X, Y, and Z registers – can be used as 16-bit
address pointers for indirect addressing of the data space.
R S Ananda Murthy Understanding Atmega328P Microcontroller
Arithmetic Logic Unit (ALU) and Data Path
32 x 8 General
Purpose
Registers
ALU
8 8
Result
Status Register
H, S, V, N, Z, C
Flags
Carry Bit
Performs arithmetic, logical, or bit-function operations
between general purpose registers or between a register
and an immediate data within a single CPU clock cycle.
Can perform multiplication using on-chip 2-cycle multiplier.
Status Register is updated after all ALU operations, as
explained in the Instruction Set Reference.
R S Ananda Murthy Understanding Atmega328P Microcontroller
Status Register – for Conditional Branching
Bit 7 6 5 4 3 2 1 0
0x3F (0x5F) I T H S V N Z C SREG
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
Initial Value 0 0 0 0 0 0 0 0
I – Global Interrupt Enable bit. Explained later.
T – Bit Copy Storage. Explained later.
H – Half carry flag. Explained later.
S – Sign flag. S = N⊕V. Explained later.
V – Overflow flag. Explained later.
N – The negative flag. N = MSB of result.
Z – Zero flag. Z = 1 if result is 0. Z = 0 if result is 1.
C – Carry flag. C = 1 if there is carry from D7.
R S Ananda Murthy Understanding Atmega328P Microcontroller
Power On Reset (POR)
When Vcc is applied to the AVR microcontroller, it is
automatically reset.
This is known as Power On Reset (POR).
After POR, the Program Counter is loaded with the reset
address $0000 so that the instruction present in that
location is executed.
In Atmega328P, the user has to write a jump instruction
(JMP) at location $0000 to jump to the desired application.
Other events which can reset the MCU will be explained in
detail later.
R S Ananda Murthy Understanding Atmega328P Microcontroller
Clock Distribution in Atmega328P
R S Ananda Murthy Understanding Atmega328P Microcontroller
AVR Clock System
Clock Control Unit in side the chip generates clocks for
memory and IO devices.
Multiple clock signals are generated in side the chip.
All of the clocks need not be active at a given time.
In order to reduce power consumption, the clocks to
modules not being used can be halted by using different
sleep modes.
Default is internal 8 MHz R-C oscillator which is divided by
8 by prescaler to give a 1 MHz CPU clock.
Default CPU clock is only 5-10% accurate.
Option to use external crystal clock source (max 20 MHz)
is also available.
Selection of system clock by software will be explained later.
R S Ananda Murthy Understanding Atmega328P Microcontroller
Power Management Features in Atmega328P
Unused modules can be shut down to save power.
Six Sleep Modes – Idle, ADC Noise Reduction,
Power-save, Power-down, Standby, and Extended Standby.
From power down mode the device can be made to wake
up on external reset or when the watchdog timer reset
occurs.
From power save mode the device can be made to wake
up on timer events.
Power management by software will be explained later.
R S Ananda Murthy Understanding Atmega328P Microcontroller
Watchdog Timer
When MCU is hanging due to any reason, the watchdog
timer will timeout and produce an internal reset signal to
load the Program Counter with the reset address $0000.
During normal operation, the MCU regularly restarts the
watchdog timer to prevent it from elapsing, or timing out.
More details about watchdog timer will be given later.
R S Ananda Murthy Understanding Atmega328P Microcontroller
License
This work is licensed under a
Creative Commons Attribution 4.0 International License.
R S Ananda Murthy Understanding Atmega328P Microcontroller

Más contenido relacionado

La actualidad más candente

Programmable array logic
Programmable array logicProgrammable array logic
Programmable array logic
Gaditek
 
UNIT-IV .FINITE STATE MACHINES
UNIT-IV .FINITE STATE MACHINESUNIT-IV .FINITE STATE MACHINES
UNIT-IV .FINITE STATE MACHINES
Dr.YNM
 

La actualidad más candente (20)

L12 c-language-programming-of-atmega328 p
L12 c-language-programming-of-atmega328 pL12 c-language-programming-of-atmega328 p
L12 c-language-programming-of-atmega328 p
 
ARDUINO EMBEDDED SYSTEM
ARDUINO EMBEDDED SYSTEMARDUINO EMBEDDED SYSTEM
ARDUINO EMBEDDED SYSTEM
 
ARM Exception and interrupts
ARM Exception and interrupts ARM Exception and interrupts
ARM Exception and interrupts
 
Programmable array logic
Programmable array logicProgrammable array logic
Programmable array logic
 
Embedded C programming based on 8051 microcontroller
Embedded C programming based on 8051 microcontrollerEmbedded C programming based on 8051 microcontroller
Embedded C programming based on 8051 microcontroller
 
Programmable logic devices
Programmable logic devicesProgrammable logic devices
Programmable logic devices
 
CMOS Logic Circuits
CMOS Logic CircuitsCMOS Logic Circuits
CMOS Logic Circuits
 
Introduction to embedded system
Introduction to embedded systemIntroduction to embedded system
Introduction to embedded system
 
UNIT-IV .FINITE STATE MACHINES
UNIT-IV .FINITE STATE MACHINESUNIT-IV .FINITE STATE MACHINES
UNIT-IV .FINITE STATE MACHINES
 
Embedded C - Optimization techniques
Embedded C - Optimization techniquesEmbedded C - Optimization techniques
Embedded C - Optimization techniques
 
Introduction to 8085 Microprocessors
Introduction to 8085 MicroprocessorsIntroduction to 8085 Microprocessors
Introduction to 8085 Microprocessors
 
Programmable Logic Array(PLA) & Programmable Array Logic(PAL)
Programmable Logic Array(PLA) & Programmable Array Logic(PAL)Programmable Logic Array(PLA) & Programmable Array Logic(PAL)
Programmable Logic Array(PLA) & Programmable Array Logic(PAL)
 
I o ports.ppt
I o ports.pptI o ports.ppt
I o ports.ppt
 
L13 interrupts-in-atmega328 p
L13 interrupts-in-atmega328 pL13 interrupts-in-atmega328 p
L13 interrupts-in-atmega328 p
 
Embedded C - Lecture 1
Embedded C - Lecture 1Embedded C - Lecture 1
Embedded C - Lecture 1
 
Embedded _c_
Embedded  _c_Embedded  _c_
Embedded _c_
 
Embedded systems
Embedded systemsEmbedded systems
Embedded systems
 
isa architecture
isa architectureisa architecture
isa architecture
 
Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)
 
SERVO MOTOR CONTROLLER
SERVO MOTOR CONTROLLERSERVO MOTOR CONTROLLER
SERVO MOTOR CONTROLLER
 

Destacado

Destacado (20)

L16 usart-atmega328 p
L16 usart-atmega328 pL16 usart-atmega328 p
L16 usart-atmega328 p
 
L7 starting-to-use-mcu
L7 starting-to-use-mcuL7 starting-to-use-mcu
L7 starting-to-use-mcu
 
L3 instruction-execution-steps
L3 instruction-execution-stepsL3 instruction-execution-steps
L3 instruction-execution-steps
 
L14 kb-lcd-interfacing-with-atmega328 p
L14 kb-lcd-interfacing-with-atmega328 pL14 kb-lcd-interfacing-with-atmega328 p
L14 kb-lcd-interfacing-with-atmega328 p
 
L11 assembly-language-programming-of-atmega328 p
L11 assembly-language-programming-of-atmega328 pL11 assembly-language-programming-of-atmega328 p
L11 assembly-language-programming-of-atmega328 p
 
Arduino atmega328
Arduino atmega328Arduino atmega328
Arduino atmega328
 
Introduction to-Tex-and-LaTeX
Introduction to-Tex-and-LaTeXIntroduction to-Tex-and-LaTeX
Introduction to-Tex-and-LaTeX
 
L10 assembly-language-programming-of-atmega328 p
L10 assembly-language-programming-of-atmega328 pL10 assembly-language-programming-of-atmega328 p
L10 assembly-language-programming-of-atmega328 p
 
L15 timers-counters-in-atmega328 p
L15 timers-counters-in-atmega328 pL15 timers-counters-in-atmega328 p
L15 timers-counters-in-atmega328 p
 
Lecture-1 : Introduction to Power Electronics
Lecture-1 : Introduction to Power ElectronicsLecture-1 : Introduction to Power Electronics
Lecture-1 : Introduction to Power Electronics
 
Trends in-power-electronics
Trends in-power-electronicsTrends in-power-electronics
Trends in-power-electronics
 
L6 primary-memory
L6 primary-memoryL6 primary-memory
L6 primary-memory
 
L5 data-parallel-computers
L5 data-parallel-computersL5 data-parallel-computers
L5 data-parallel-computers
 
L1 intro-to-mpu-mcu
L1 intro-to-mpu-mcuL1 intro-to-mpu-mcu
L1 intro-to-mpu-mcu
 
Transformers
TransformersTransformers
Transformers
 
L4 speeding-up-execution
L4 speeding-up-executionL4 speeding-up-execution
L4 speeding-up-execution
 
Lecture-5 : Semiconductor Power Switching Devices-2
Lecture-5 : Semiconductor Power Switching Devices-2Lecture-5 : Semiconductor Power Switching Devices-2
Lecture-5 : Semiconductor Power Switching Devices-2
 
Lecture-3 : More Applications of Power Electronics
Lecture-3 : More Applications of Power ElectronicsLecture-3 : More Applications of Power Electronics
Lecture-3 : More Applications of Power Electronics
 
Lecture-7 : Semiconductor Power Switching Devices-4
Lecture-7 : Semiconductor Power Switching Devices-4Lecture-7 : Semiconductor Power Switching Devices-4
Lecture-7 : Semiconductor Power Switching Devices-4
 
Lecture-2 : Applications of Power Electronics
Lecture-2 : Applications of Power ElectronicsLecture-2 : Applications of Power Electronics
Lecture-2 : Applications of Power Electronics
 

Similar a L9 understanding-atmega328 p-2

Atmel 42735-8-bit-avr-microcontroller-a tmega328-328-p_summary
Atmel 42735-8-bit-avr-microcontroller-a tmega328-328-p_summaryAtmel 42735-8-bit-avr-microcontroller-a tmega328-328-p_summary
Atmel 42735-8-bit-avr-microcontroller-a tmega328-328-p_summary
Rajan Gautam
 
Atmel 2486-8-bit-avr-microcontroller-atmega8 l-datasheet
Atmel 2486-8-bit-avr-microcontroller-atmega8 l-datasheetAtmel 2486-8-bit-avr-microcontroller-atmega8 l-datasheet
Atmel 2486-8-bit-avr-microcontroller-atmega8 l-datasheet
sang2792
 

Similar a L9 understanding-atmega328 p-2 (20)

Atmega32
Atmega32Atmega32
Atmega32
 
8085 (1)
8085 (1)8085 (1)
8085 (1)
 
Atmega 32
Atmega 32Atmega 32
Atmega 32
 
Atmel 42735-8-bit-avr-microcontroller-a tmega328-328-p_summary
Atmel 42735-8-bit-avr-microcontroller-a tmega328-328-p_summaryAtmel 42735-8-bit-avr-microcontroller-a tmega328-328-p_summary
Atmel 42735-8-bit-avr-microcontroller-a tmega328-328-p_summary
 
Z80 microprocessor architecture1
Z80 microprocessor architecture1Z80 microprocessor architecture1
Z80 microprocessor architecture1
 
Embedded System
Embedded SystemEmbedded System
Embedded System
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontroller
 
pic_1.pdf
pic_1.pdfpic_1.pdf
pic_1.pdf
 
AVR Fundamentals
AVR FundamentalsAVR Fundamentals
AVR Fundamentals
 
Atemega saya
Atemega sayaAtemega saya
Atemega saya
 
Atmega8u2 mur
Atmega8u2 murAtmega8u2 mur
Atmega8u2 mur
 
Arduino and its hw architecture
Arduino and its hw architectureArduino and its hw architecture
Arduino and its hw architecture
 
Atmel 2486-8-bit-avr-microcontroller-atmega8 l-datasheet
Atmel 2486-8-bit-avr-microcontroller-atmega8 l-datasheetAtmel 2486-8-bit-avr-microcontroller-atmega8 l-datasheet
Atmel 2486-8-bit-avr-microcontroller-atmega8 l-datasheet
 
Atmega 8
Atmega 8Atmega 8
Atmega 8
 
A tmega16A Microcontroller Data Sheet
A tmega16A Microcontroller Data SheetA tmega16A Microcontroller Data Sheet
A tmega16A Microcontroller Data Sheet
 
8085 intro
8085 intro8085 intro
8085 intro
 
Introduction to PIC.pptx
Introduction to PIC.pptxIntroduction to PIC.pptx
Introduction to PIC.pptx
 
Visitor counter
Visitor counterVisitor counter
Visitor counter
 
Introduction to 8085_by_adi_ppt
Introduction to 8085_by_adi_pptIntroduction to 8085_by_adi_ppt
Introduction to 8085_by_adi_ppt
 
Introduction to 8085 Microprocessor
Introduction to 8085 MicroprocessorIntroduction to 8085 Microprocessor
Introduction to 8085 Microprocessor
 

Último

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
Tonystark477637
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
rknatarajan
 

Último (20)

(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 

L9 understanding-atmega328 p-2

  • 1. Understanding Atmega328P Microcontroller (Lecture-9) R S Ananda Murthy Associate Professor and Head Department of Electrical & Electronics Engineering, Sri Jayachamarajendra College of Engineering, Mysore 570 006 R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 2. AVR CPU General Purpose Registers – 32×8 R0 D0D1D2. . . . . . . . . . . .D7 R1 R2 ... R13 R14 R15 0x00 0x01 0x02 0x0D 0x0E 0x0F Addr. R16 R17 ... 0x10 0x11 R26 R27 R28 0x1A 0x1B 0x1C R29 R30 0x1D 0x1E R31 0x1F ...... X Register Low-byte X Register High-byte Y Register Low-byte Y Register High-byte Z Register Low-byte Z Register High-byte Most instructions can access any register and complete operation in one CPU clock cycle. There is also a 16-bit Stack Pointer. Last three register pairs given below can be used as three 16-bit index registers to point at data memory. R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 3. X, Y, and Z Registers – 16-bit Pointers to Data D0D1D2. . . . . . . . . .D7 R26 (0x1A)R27 (0x1B) D0D1D2. . . . . . . . . .D7 015 XH XL X-Register D0D1D2. . . . . . . . . .D7 R28 (0x1C)R29 (0x1D) D0D1D2. . . . . . . . . .D7 015 YH YL Y-Register D0D1D2. . . . . . . . . .D7 R30 (0x1E)R31 (0x1F) D0D1D2. . . . . . . . . .D7 015 ZH ZL Z-Register Register pairs R27 and R26, R29 and R28, R31 and R30 known as X, Y, and Z registers – can be used as 16-bit address pointers for indirect addressing of the data space. R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 4. Arithmetic Logic Unit (ALU) and Data Path 32 x 8 General Purpose Registers ALU 8 8 Result Status Register H, S, V, N, Z, C Flags Carry Bit Performs arithmetic, logical, or bit-function operations between general purpose registers or between a register and an immediate data within a single CPU clock cycle. Can perform multiplication using on-chip 2-cycle multiplier. Status Register is updated after all ALU operations, as explained in the Instruction Set Reference. R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 5. Status Register – for Conditional Branching Bit 7 6 5 4 3 2 1 0 0x3F (0x5F) I T H S V N Z C SREG Read/Write R/W R/W R/W R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0 I – Global Interrupt Enable bit. Explained later. T – Bit Copy Storage. Explained later. H – Half carry flag. Explained later. S – Sign flag. S = N⊕V. Explained later. V – Overflow flag. Explained later. N – The negative flag. N = MSB of result. Z – Zero flag. Z = 1 if result is 0. Z = 0 if result is 1. C – Carry flag. C = 1 if there is carry from D7. R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 6. Power On Reset (POR) When Vcc is applied to the AVR microcontroller, it is automatically reset. This is known as Power On Reset (POR). After POR, the Program Counter is loaded with the reset address $0000 so that the instruction present in that location is executed. In Atmega328P, the user has to write a jump instruction (JMP) at location $0000 to jump to the desired application. Other events which can reset the MCU will be explained in detail later. R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 7. Clock Distribution in Atmega328P R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 8. AVR Clock System Clock Control Unit in side the chip generates clocks for memory and IO devices. Multiple clock signals are generated in side the chip. All of the clocks need not be active at a given time. In order to reduce power consumption, the clocks to modules not being used can be halted by using different sleep modes. Default is internal 8 MHz R-C oscillator which is divided by 8 by prescaler to give a 1 MHz CPU clock. Default CPU clock is only 5-10% accurate. Option to use external crystal clock source (max 20 MHz) is also available. Selection of system clock by software will be explained later. R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 9. Power Management Features in Atmega328P Unused modules can be shut down to save power. Six Sleep Modes – Idle, ADC Noise Reduction, Power-save, Power-down, Standby, and Extended Standby. From power down mode the device can be made to wake up on external reset or when the watchdog timer reset occurs. From power save mode the device can be made to wake up on timer events. Power management by software will be explained later. R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 10. Watchdog Timer When MCU is hanging due to any reason, the watchdog timer will timeout and produce an internal reset signal to load the Program Counter with the reset address $0000. During normal operation, the MCU regularly restarts the watchdog timer to prevent it from elapsing, or timing out. More details about watchdog timer will be given later. R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 11. License This work is licensed under a Creative Commons Attribution 4.0 International License. R S Ananda Murthy Understanding Atmega328P Microcontroller