SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
Understanding Atmega328P Microcontroller
(Lecture-8)
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
Atmega328P Features
High Performance, Low Power Atmel AVR 8-Bit
Microcontroller Family.
Advanced RISC Harvard Architecture
131 Powerful Instructions – Most Single Clock Cycle
Execution
32×8 General Purpose Working Registers
Fully Static Operation (with power on, the contents of
registers remain intact even with no clock signal)
Up to 20 MIPS Throughput at 20 MHz
On-chip 2-cycle Multiplier
Operating Voltage
1.8 V to 5.5 V
Temperature Range
−40◦ C to 85◦ C
R S Ananda Murthy Understanding Atmega328P Microcontroller
Atmega328P Features
High Endurance Non-volatile Memory Segments
32 K Bytes of In-System Self-Programmable Flash program
memory
1 K Bytes EEPROM
2 K Bytes Internal SRAM
Write/Erase Cycles: 10,000 Flash/100,000 EEPROM
Optional Boot Code Section with Independent Lock Bits
Programming Lock for Software Security
I/O and Packages
23 Programmable I/O Lines
28-pin PDIP, 32-lead TQFP, 28-pad QFN/MLF and 32-pad
QFN/MLF
R S Ananda Murthy Understanding Atmega328P Microcontroller
Atmega328P Features
Peripheral Features
Two 8-bit Timer/Counters with Separate Prescaler and
Compare Mode
One 16-bit Timer/Counter with Separate Prescaler,
Compare Mode, and Capture Mode
Real Time Counter with Separate Oscillator
Six PWM Channels
8-channel 10-bit ADC in TQFP and QFN/MLF package
6-channel 10-bit ADC in PDIP Package
Programmable Serial USART
Master/Slave SPI Serial Interface
Byte-oriented 2-wire Serial Interface (Philips I2C
compatible)
Programmable Watchdog Timer with Separate On-chip
Oscillator
On-chip Analog Comparator
Interrupt and Wake-up on Pin Change
R S Ananda Murthy Understanding Atmega328P Microcontroller
Atmega328P Features
Special Microcontroller Features
Power-on Reset and Programmable Brown-out Detection
Internal Calibrated Oscillator
External and Internal Interrupt Sources
Six Sleep Modes: Idle, ADC Noise Reduction, Power-save,
Power-down, Standby, and Extended Standby
Speed Grade
0 - 4 MHz @ 1.8 - 5.5V, 0 - 10 MHz @ 2.7 - 5.5 V, 0 -
20MHz @ 4.5 - 5.5 V
Power Consumption at 1 MHz, 1.8 V, 25◦C
Active Mode: 0.2mA
Power-down Mode: 0.1µA
Power-save Mode: 0.75µA (Including 32kHz RTC)
R S Ananda Murthy Understanding Atmega328P Microcontroller
Types of Atmega328P Packages
28-Pin Plastic Dual In-line Package (PDIP)
R S Ananda Murthy Understanding Atmega328P Microcontroller
Types of Atmega328P Packages
32-pin Thin Quad Flat Package (TQFP)
R S Ananda Murthy Understanding Atmega328P Microcontroller
Types of Atmega328P Packages
32-pin Micro Lead Frame (MLF) or
Quad Flat No-leads (QFN) package.
A similar 28-pin package is also available.
R S Ananda Murthy Understanding Atmega328P Microcontroller
Atmega328P PDIP Pinout Details
Many pins have more than one function
R S Ananda Murthy Understanding Atmega328P Microcontroller
Atmega328P PDIP Signals
R S Ananda Murthy Understanding Atmega328P Microcontroller
Atmega328P 32-TQFP Signals
R S Ananda Murthy Understanding Atmega328P Microcontroller
Atmega328P 32-MLF Signals
R S Ananda Murthy Understanding Atmega328P Microcontroller
Pin Descriptions of Atmega328P
Vcc – Supply voltage.
GND – Ground.
Port B (PB7:0) XTAL1/XTAL2/TOSC1/TOSC2 – 8-bit
bi-directional I/O port with internal pull-up resistors.
Across PB7 and PB6 external oscillator or quartz crystal
should be connected to generate chip clock signal if
internal oscillator is not used.
PB7 and PB6 is used as TOSC2...1 input for the
Asynchronous Timer/Counter2 if the AS2 bit in ASSR is
set, when internal chip clock is used.
R S Ananda Murthy Understanding Atmega328P Microcontroller
Pin Descriptions of Atmega328P
Port C (PC5:0) – These are six lines of 7-bit bi-directional
I/O port with internal pull-up resistors.
PC6/RESET – Depending upon how the chip is
programmed, this pin can be used as an I/O pin or as input
to reset the MCU.
Port D (PD7:0) – 8-bit bi-directional I/O port with internal
pull-up resistors.
R S Ananda Murthy Understanding Atmega328P Microcontroller
Pin Descriptions of Atmega328P
AVcc – supply voltage pin for the A/D Converter, PC3:0,
and ADC7:6. It should be externally connected to Vcc ,
even if the ADC is not used. If the ADC is used, it should
be connected to Vcc through a low-pass filter.
AREF – the analog reference pin for the A/D Converter.
ADC7:6 (TQFP and QFN/MLF Package Only) – in the
TQFP and QFN/MLF package, ADC7:6 serve as analog
inputs to the A/D converter. These pins are powered from
the analog supply and serve as 10-bit ADC channels.
R S Ananda Murthy Understanding Atmega328P Microcontroller
Atmega328P Internal Block Diagram
R S Ananda Murthy Understanding Atmega328P Microcontroller
Atmega328P CPU Core Architecture
R S Ananda Murthy Understanding Atmega328P Microcontroller
Flash Program Memory in Atmega328P – 16K×16
16 Bits
D15 D14 D0D1D2. . . . . . . . . . .
$0000
$3FFF
Application Program
Section
Bootloader Section
Hex Address
16 K = 16384
Locations
Size of bootloader
section is configurable
using fuse bits
Bootloader is a
program executed by
the MCU to write code
into the flash memory
or read the code from
program memory.
Can endure at least 10,000 write/erase cycles. Nonvolatile.
Since the program memory address has 14 bits, the
Program Counter width is also 14 bits.
Bootloader can be protected using lock bits.
R S Ananda Murthy Understanding Atmega328P Microcontroller
SRAM Data Memory in Atmega328P – Volatile
32 Registers (GPRs)
D0D1D2. . . . . . . . . . . .
0x0000 - 0x001F
Hex Addresses
64 I/O Registers (SFRs)
D7
160 Ext I/O Registers
0x0020 - 0x005F
2048 x 8 Scratch Pad
0x0060 - 0x00FF
0x0100 - 0x08FF
8 Bits
Stores operands and results
of arithmetic/logical operations
Used to access peripherals
Used to access extra peripherals
Used to store temporary data
R S Ananda Murthy Understanding Atmega328P Microcontroller
EEPROM in Atmega328P
Size is 1 K×8.
It is organized as a separate data space, in which single
bytes can be read and written.
Can endure at least 100,000 write/erase cycles.
Non-volatile storage for program specific data, constants,
etc.
Requires special write sequence to store data.
Should be accessed using EEPROM Address Register,
EEPROM Data Register and EEPROM Control Register.
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

Contenu connexe

Tendances

8051 Microcontroller Notes
8051 Microcontroller Notes8051 Microcontroller Notes
8051 Microcontroller Notes
Dr.YNM
 
Interfacing adc
Interfacing adcInterfacing adc
Interfacing adc
PRADEEP
 

Tendances (20)

L15 timers-counters-in-atmega328 p
L15 timers-counters-in-atmega328 pL15 timers-counters-in-atmega328 p
L15 timers-counters-in-atmega328 p
 
8051 Microcontroller Notes
8051 Microcontroller Notes8051 Microcontroller Notes
8051 Microcontroller Notes
 
Pic microcontroller architecture
Pic microcontroller architecturePic microcontroller architecture
Pic microcontroller architecture
 
Microcontroller-8051.ppt
Microcontroller-8051.pptMicrocontroller-8051.ppt
Microcontroller-8051.ppt
 
Introduction to Microcontroller
Introduction to MicrocontrollerIntroduction to Microcontroller
Introduction to Microcontroller
 
8051 interfacing
8051 interfacing8051 interfacing
8051 interfacing
 
Pic 18 microcontroller
Pic 18 microcontrollerPic 18 microcontroller
Pic 18 microcontroller
 
8086 pin details
8086 pin details8086 pin details
8086 pin details
 
What is Arduino ?
What is Arduino ?What is Arduino ?
What is Arduino ?
 
Interfacing adc
Interfacing adcInterfacing adc
Interfacing adc
 
Introduction to Embedded Architecture
Introduction to Embedded Architecture Introduction to Embedded Architecture
Introduction to Embedded Architecture
 
PIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikarPIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikar
 
8051 Microcontroller ppt
8051 Microcontroller ppt8051 Microcontroller ppt
8051 Microcontroller ppt
 
Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)
 
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I Core of Embedded Systems
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I   Core of Embedded SystemsSYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I   Core of Embedded Systems
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I Core of Embedded Systems
 
Msp 430 architecture module 1
Msp 430 architecture module 1Msp 430 architecture module 1
Msp 430 architecture module 1
 
Introduction to Microcontroller
Introduction to MicrocontrollerIntroduction to Microcontroller
Introduction to Microcontroller
 
microcontroller basics
microcontroller basicsmicrocontroller basics
microcontroller basics
 
Embedded Systems (18EC62) - ARM Cortex-M3 Instruction Set and Programming (Mo...
Embedded Systems (18EC62) - ARM Cortex-M3 Instruction Set and Programming (Mo...Embedded Systems (18EC62) - ARM Cortex-M3 Instruction Set and Programming (Mo...
Embedded Systems (18EC62) - ARM Cortex-M3 Instruction Set and Programming (Mo...
 
Introduction to arm processor
Introduction to arm processorIntroduction to arm processor
Introduction to arm processor
 

Similaire à L8 understanding-atmega328 p-1

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 microcontrollers-a tmega328-p_datasheet
Atmel microcontrollers-a tmega328-p_datasheetAtmel microcontrollers-a tmega328-p_datasheet
Atmel microcontrollers-a tmega328-p_datasheet
AlexTronciu
 
Atmel 8159-8-bit-avr-microcontroller-a tmega8-a_datasheet
Atmel 8159-8-bit-avr-microcontroller-a tmega8-a_datasheetAtmel 8159-8-bit-avr-microcontroller-a tmega8-a_datasheet
Atmel 8159-8-bit-avr-microcontroller-a tmega8-a_datasheet
Arpan Saha
 
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
 

Similaire à L8 understanding-atmega328 p-1 (20)

Atmega32
Atmega32Atmega32
Atmega32
 
Atmega 32
Atmega 32Atmega 32
Atmega 32
 
A tmega16A Microcontroller Data Sheet
A tmega16A Microcontroller Data SheetA tmega16A Microcontroller Data Sheet
A tmega16A Microcontroller Data Sheet
 
Atemega saya
Atemega sayaAtemega saya
Atemega saya
 
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
 
Atmega8u2 mur
Atmega8u2 murAtmega8u2 mur
Atmega8u2 mur
 
Atmega16 datasheet
Atmega16 datasheetAtmega16 datasheet
Atmega16 datasheet
 
Atmega16 Microconntroller Data sheet
Atmega16 Microconntroller Data sheetAtmega16 Microconntroller Data sheet
Atmega16 Microconntroller Data sheet
 
Atmel microcontrollers-a tmega328-p_datasheet
Atmel microcontrollers-a tmega328-p_datasheetAtmel microcontrollers-a tmega328-p_datasheet
Atmel microcontrollers-a tmega328-p_datasheet
 
Atmel 8159-8-bit-avr-microcontroller-a tmega8-a_datasheet
Atmel 8159-8-bit-avr-microcontroller-a tmega8-a_datasheetAtmel 8159-8-bit-avr-microcontroller-a tmega8-a_datasheet
Atmel 8159-8-bit-avr-microcontroller-a tmega8-a_datasheet
 
A tmega8 l
A tmega8 lA tmega8 l
A tmega8 l
 
Doc2502
Doc2502Doc2502
Doc2502
 
L9 understanding-atmega328 p-2
L9 understanding-atmega328 p-2L9 understanding-atmega328 p-2
L9 understanding-atmega328 p-2
 
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
 
Overview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontrollerOverview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontroller
 
Embedded system design using arduino
Embedded system design using arduinoEmbedded system design using arduino
Embedded system design using arduino
 
Study on 32-bit Cortex - M3 Powered MCU: STM32F101
Study on 32-bit Cortex - M3 Powered MCU: STM32F101Study on 32-bit Cortex - M3 Powered MCU: STM32F101
Study on 32-bit Cortex - M3 Powered MCU: STM32F101
 
Atmega324 p
Atmega324 pAtmega324 p
Atmega324 p
 
Atmega 8
Atmega 8Atmega 8
Atmega 8
 
Atmel-7735-Automotive-Microcontrollers-ATmega169P_-968165.pdf
Atmel-7735-Automotive-Microcontrollers-ATmega169P_-968165.pdfAtmel-7735-Automotive-Microcontrollers-ATmega169P_-968165.pdf
Atmel-7735-Automotive-Microcontrollers-ATmega169P_-968165.pdf
 

Plus de rsamurti

Plus de rsamurti (20)

EE110-elementary-circuit-and-network-theory-(a)
EE110-elementary-circuit-and-network-theory-(a)EE110-elementary-circuit-and-network-theory-(a)
EE110-elementary-circuit-and-network-theory-(a)
 
Trends in-power-electronics
Trends in-power-electronicsTrends in-power-electronics
Trends in-power-electronics
 
L3 instruction-execution-steps
L3 instruction-execution-stepsL3 instruction-execution-steps
L3 instruction-execution-steps
 
L1 intro-to-mpu-mcu
L1 intro-to-mpu-mcuL1 intro-to-mpu-mcu
L1 intro-to-mpu-mcu
 
Introduction to-Tex-and-LaTeX
Introduction to-Tex-and-LaTeXIntroduction to-Tex-and-LaTeX
Introduction to-Tex-and-LaTeX
 
Synchronous generators
Synchronous generatorsSynchronous generators
Synchronous generators
 
Transformers
TransformersTransformers
Transformers
 
Three phase-circuits
Three phase-circuitsThree phase-circuits
Three phase-circuits
 
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
 
L13 interrupts-in-atmega328 p
L13 interrupts-in-atmega328 pL13 interrupts-in-atmega328 p
L13 interrupts-in-atmega328 p
 
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
 
L16 usart-atmega328 p
L16 usart-atmega328 pL16 usart-atmega328 p
L16 usart-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
 
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
 
L7 starting-to-use-mcu
L7 starting-to-use-mcuL7 starting-to-use-mcu
L7 starting-to-use-mcu
 
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
 
L4 speeding-up-execution
L4 speeding-up-executionL4 speeding-up-execution
L4 speeding-up-execution
 
L2 types-of-computers
L2 types-of-computersL2 types-of-computers
L2 types-of-computers
 
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
 

Dernier

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
chumtiyababu
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Dernier (20)

Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptx
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 

L8 understanding-atmega328 p-1

  • 1. Understanding Atmega328P Microcontroller (Lecture-8) 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. Atmega328P Features High Performance, Low Power Atmel AVR 8-Bit Microcontroller Family. Advanced RISC Harvard Architecture 131 Powerful Instructions – Most Single Clock Cycle Execution 32×8 General Purpose Working Registers Fully Static Operation (with power on, the contents of registers remain intact even with no clock signal) Up to 20 MIPS Throughput at 20 MHz On-chip 2-cycle Multiplier Operating Voltage 1.8 V to 5.5 V Temperature Range −40◦ C to 85◦ C R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 3. Atmega328P Features High Endurance Non-volatile Memory Segments 32 K Bytes of In-System Self-Programmable Flash program memory 1 K Bytes EEPROM 2 K Bytes Internal SRAM Write/Erase Cycles: 10,000 Flash/100,000 EEPROM Optional Boot Code Section with Independent Lock Bits Programming Lock for Software Security I/O and Packages 23 Programmable I/O Lines 28-pin PDIP, 32-lead TQFP, 28-pad QFN/MLF and 32-pad QFN/MLF R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 4. Atmega328P Features Peripheral Features Two 8-bit Timer/Counters with Separate Prescaler and Compare Mode One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode Real Time Counter with Separate Oscillator Six PWM Channels 8-channel 10-bit ADC in TQFP and QFN/MLF package 6-channel 10-bit ADC in PDIP Package Programmable Serial USART Master/Slave SPI Serial Interface Byte-oriented 2-wire Serial Interface (Philips I2C compatible) Programmable Watchdog Timer with Separate On-chip Oscillator On-chip Analog Comparator Interrupt and Wake-up on Pin Change R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 5. Atmega328P Features Special Microcontroller Features Power-on Reset and Programmable Brown-out Detection Internal Calibrated Oscillator External and Internal Interrupt Sources Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby, and Extended Standby Speed Grade 0 - 4 MHz @ 1.8 - 5.5V, 0 - 10 MHz @ 2.7 - 5.5 V, 0 - 20MHz @ 4.5 - 5.5 V Power Consumption at 1 MHz, 1.8 V, 25◦C Active Mode: 0.2mA Power-down Mode: 0.1µA Power-save Mode: 0.75µA (Including 32kHz RTC) R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 6. Types of Atmega328P Packages 28-Pin Plastic Dual In-line Package (PDIP) R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 7. Types of Atmega328P Packages 32-pin Thin Quad Flat Package (TQFP) R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 8. Types of Atmega328P Packages 32-pin Micro Lead Frame (MLF) or Quad Flat No-leads (QFN) package. A similar 28-pin package is also available. R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 9. Atmega328P PDIP Pinout Details Many pins have more than one function R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 10. Atmega328P PDIP Signals R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 11. Atmega328P 32-TQFP Signals R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 12. Atmega328P 32-MLF Signals R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 13. Pin Descriptions of Atmega328P Vcc – Supply voltage. GND – Ground. Port B (PB7:0) XTAL1/XTAL2/TOSC1/TOSC2 – 8-bit bi-directional I/O port with internal pull-up resistors. Across PB7 and PB6 external oscillator or quartz crystal should be connected to generate chip clock signal if internal oscillator is not used. PB7 and PB6 is used as TOSC2...1 input for the Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set, when internal chip clock is used. R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 14. Pin Descriptions of Atmega328P Port C (PC5:0) – These are six lines of 7-bit bi-directional I/O port with internal pull-up resistors. PC6/RESET – Depending upon how the chip is programmed, this pin can be used as an I/O pin or as input to reset the MCU. Port D (PD7:0) – 8-bit bi-directional I/O port with internal pull-up resistors. R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 15. Pin Descriptions of Atmega328P AVcc – supply voltage pin for the A/D Converter, PC3:0, and ADC7:6. It should be externally connected to Vcc , even if the ADC is not used. If the ADC is used, it should be connected to Vcc through a low-pass filter. AREF – the analog reference pin for the A/D Converter. ADC7:6 (TQFP and QFN/MLF Package Only) – in the TQFP and QFN/MLF package, ADC7:6 serve as analog inputs to the A/D converter. These pins are powered from the analog supply and serve as 10-bit ADC channels. R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 16. Atmega328P Internal Block Diagram R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 17. Atmega328P CPU Core Architecture R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 18. Flash Program Memory in Atmega328P – 16K×16 16 Bits D15 D14 D0D1D2. . . . . . . . . . . $0000 $3FFF Application Program Section Bootloader Section Hex Address 16 K = 16384 Locations Size of bootloader section is configurable using fuse bits Bootloader is a program executed by the MCU to write code into the flash memory or read the code from program memory. Can endure at least 10,000 write/erase cycles. Nonvolatile. Since the program memory address has 14 bits, the Program Counter width is also 14 bits. Bootloader can be protected using lock bits. R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 19. SRAM Data Memory in Atmega328P – Volatile 32 Registers (GPRs) D0D1D2. . . . . . . . . . . . 0x0000 - 0x001F Hex Addresses 64 I/O Registers (SFRs) D7 160 Ext I/O Registers 0x0020 - 0x005F 2048 x 8 Scratch Pad 0x0060 - 0x00FF 0x0100 - 0x08FF 8 Bits Stores operands and results of arithmetic/logical operations Used to access peripherals Used to access extra peripherals Used to store temporary data R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 20. EEPROM in Atmega328P Size is 1 K×8. It is organized as a separate data space, in which single bytes can be read and written. Can endure at least 100,000 write/erase cycles. Non-volatile storage for program specific data, constants, etc. Requires special write sequence to store data. Should be accessed using EEPROM Address Register, EEPROM Data Register and EEPROM Control Register. R S Ananda Murthy Understanding Atmega328P Microcontroller
  • 21. License This work is licensed under a Creative Commons Attribution 4.0 International License. R S Ananda Murthy Understanding Atmega328P Microcontroller