SlideShare a Scribd company logo
Introduction to Microcontrollers
Lecture 2
1
 Microcontroller
 CPU + ++++++++++
 Microprocessor
 CPU (on single chip)
Microcontrollers
2
What is a Microcontroller
 Integrated chip that typically contains integrated CPU, memory (RAM
ROM), I/O ports on a single Chip.
 System on a single Chip/ small computer on a single chip
 Designed to execute a specific task to control a single system
 Smaller & Specified (design cost)
 Differs from Microprocessor
general-purpose chip
Used to design multi purpose computers or devices
Require Multiple chips to handle various tasks
 Typically Microcontroller embedded inside some device
 Microcontrollers are important part of Embedded systems 3
What is a Development Board
• A printed circuit board
designed to facilitate
work with a particular
microcontroller.
• Typical components include:
• power circuit
• programming interface
• basic input; usually buttons and LEDs
• I/O pins
4
The Arduino Development Board
5
Arduino (The name is an Italian , meaning “strong friend”) is an open-
source platform used for building electronics projects. Arduino consists of both a
physical programmable circuit board (often referred to as a microcontroller) and a
piece of software, or IDE (Integrated Development Environment) that runs on your
computer, used to write and upload computer code to the physical board.
Arduino Microcontroller Boards
Microcontroller ATmega328
Operating Voltage 5 V
Input Voltage
(recommended)
7-12 V
Input Voltage (limits) 6-20 V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory
32 KB (ATmega328) of which 2 KB used by
bootloader
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)
Clock Speed 16 MHz
6
ATmega328 Internal Architecture
7
ATmega328 Microcontroller
Pin number
Pin name
Special
function
8
Microcontroller Ports and Pins
 The communication channels
through which information
flows into or out of the
microcontroller
 Ex. PORTB
 Pins PB0 – PB7
 May not be contiguous
 Often bi-directional
C
9
ATmega328
Block Diagram
Input
Output
10
Setting the Pin Data Direction
 Arduino
 pinMode(pin_no., dir)
 Ex. Make Arduino pin 3 (PD3) an output
 pinMode(3, OUTPUT);
 Note: one pin at a time
 Suppose you wanted Arduino pins 3, 5, and 7
(PD3, PD5, and PD7) to be outputs?
 Is there a way to make them all outputs at the
same time?
 Yes! Answer coming later…
11
Atmega328 Overview
12
8-bit CPU
Timer/Counter
Internal
memories
 32KB Flash
 1KB EEPROM
 2KB SRAM
Serial Peripheral
Interface
Universal Synchronous
and Asynchronous
serial Receiver and
Transmitter (Serial)
GPIO 2-wire Serial
Interface
AVR Microcontroller
AVR stand for?
 Advanced Virtual RISC,
the founders are Alf Egil Bogen Vegard Wollan RISC
AVR architecture was conceived by two students at
Norwegian Institute of Technology (NTH) and further refined
and developed at Atmel Norway (Atmel AVR).
13
AVR Microcontroller
 AVR Micro controllers is Family of RISC
Microcontrollers from Atmel.
 There are multiple architectures
RISC (Reduced Instruction Set Computer)
CISC (Complex Instruction Set Computer)
14
RISC Microcontroller
Reduced Instruction Set Computers Advantages
 Fast Execution of Instructions due to simple instructions for
CPU.
 RISC chips require fewer transistors, which makes them
cheaper to design and produce.
 Emphasis on software
 Single-clock , reduced instruction only
 Register to register: “LOAD" and "STORE“ are independent
instructions
 Spends more transistors on memory registers
15
16
On Chip
Debugger
Two Wire
Interface
The AVR is a Harvard architecture CPU.
 Harvard Architecture
 Computer architectures that used physically separate storage
and signal pathways for their instructions and data.
 CPU can read both an instruction and data from memory
at the same time that makes it faster.
 von Neumann architecture
 CPU can Read an instruction or data from/to the memory.
 Read, Write can`t occur at the same time due to same
memory and signal pathway for data and instructions.
AVR Microcontroller
17
Harvard Architecture
AVR Microcontroller
Harvard Architecture diagram
18
AVR Microcontroller
 AVR is a family of 8-bit microntrollers with a large range of variants
differing in:
- size of program-memory (flash)
- size of EEPROM memory
- number of I/O pins
- number of on-chip features such as UART and ADC
 Smallest microcontroller is the ATTiny11 with 1k flash ROM, no RAM
and 6 I/O pins.
 Large such as the ATMEGA128 with 128k flash, 4KB RAM, 53 I/O pins
and lots of on-chip features.
19
AVR Microcontroller
20
AVR Architecture
• Registers
• Instruction Set
• I/O ports
• Memory (flash & RAM & ROM)
• CPU
21
AVR Architecture
 Registers: Two types of registers
GERNEL purpose & SPECIAL purpose registers
 GERNEL purpose
32 general purpose registers having storage capacity of
8-Bits
Named as R0,R1,R2 to R31.
Register 0 to 15 & 16 to 31 are different.
Can store both Data & Addresses.
 SPECIAL purpose: Three registers
Program counter
Stack Pointer
Status Register 22
23
AVR Memory Space
• Program Flash
– Vectors, Code, and
(Unchangeable) Constant Data
• Working Registers
– Includes X, Y, and Z registers.
• I/O Register Space
– Includes “named” registers
• SRAM – Data Space
– Runtime Variables and Data
– Stack space
• EEPROM space
– For non-volatile but alterable data
AVR Architecture
Pointer Register
Three 16-bit address registers pairs of registers 26 to 31
have extra meaning in AVR assembly.
X (r27:r26), y (r29:r28), z (r31:r30).
pointer Sequence
X
Read/Write from address X,
don't change the pointer
24
AVR Architecture
status register
(SREG) It is 8-bit long each bit has a different meaning.
I: Global Interrupt Enable/Disable Flag, SREG7
T: Transfer bit used by BLD and BST instructions, SREG6
H: Half Carry Flag, SREG5
S: For signed tests Instruction Set, SREG4
V: Two's complement overflow indicator, SREG3
N: Negative Flag, SREG2
Z: Zero Flag, SREG1
C: Carry Flag, SREG0
I Z
T N
H S V C
25
AVR Architecture
Stack Pointer (SP)
16-bit stack pointer (SP) holds address in data space of area
to save function call information.
26
AVR
Register Architecture
27
AVR Architecture
Memory:
There are two separate
memories
Program Memory
Data Memory
28
AVR Studio
 Integrated Development Environment (IDE) for
writing and debugging AVR applications for
windows environments.
 AVR Studio provides a project management tool,
source file editor, chip simulator and In-circuit
emulator interface for the powerful AVR 8-bit
RISC family of microcontrollers.
29

More Related Content

PDF
1-AVR Introduction to Atmega32 good .pdf
PPTX
Embedded system design using arduino
PPTX
3.TechieNest microcontrollers
PPT
microcontroller basics
PPT
Microprocessor Systems and Interfacing Slides
PPTX
unit-2.pptx
PPT
Chp4 introduction to the pic microcontroller copy
PPTX
CHAPTER1.pptx ON 8051 MICROCONTROLLER INTRODUCTION CHAPTER
1-AVR Introduction to Atmega32 good .pdf
Embedded system design using arduino
3.TechieNest microcontrollers
microcontroller basics
Microprocessor Systems and Interfacing Slides
unit-2.pptx
Chp4 introduction to the pic microcontroller copy
CHAPTER1.pptx ON 8051 MICROCONTROLLER INTRODUCTION CHAPTER

Similar to The document provides an overview of the Arduino platform for beginners. (20)

PPT
arm 7 microprocessor architecture ans pin diagram.ppt
PPT
armcores introduction to arm provessor.ppt
PPT
Avr microcontroller
PPT
Embedded systems POWER SUPPLIES ARDUINO UNO
PPT
Embedded systems applications and atmega328.ppt
DOC
PPTX
Microcontroller
PPTX
Microcontroller from basic_to_advanced
PPTX
embedded system and microcontroller
PPTX
Atmega16
PPT
PIC Introduction and explained in detailed
DOC
Pc based wire less data aquisition system using rf(1)
PDF
Introduction to 8085 Microprocessors
DOCX
Assignment
PPTX
Overview of Microcontroller and ATMega32 microcontroller
PPTX
1. Microcontroller Basics ENTC department.pptx
PDF
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
PDF
assignment 1-MC.pdf
PPTX
Introduction to microprocessor
PDF
Advanced microprocessor
arm 7 microprocessor architecture ans pin diagram.ppt
armcores introduction to arm provessor.ppt
Avr microcontroller
Embedded systems POWER SUPPLIES ARDUINO UNO
Embedded systems applications and atmega328.ppt
Microcontroller
Microcontroller from basic_to_advanced
embedded system and microcontroller
Atmega16
PIC Introduction and explained in detailed
Pc based wire less data aquisition system using rf(1)
Introduction to 8085 Microprocessors
Assignment
Overview of Microcontroller and ATMega32 microcontroller
1. Microcontroller Basics ENTC department.pptx
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
assignment 1-MC.pdf
Introduction to microprocessor
Advanced microprocessor
Ad

Recently uploaded (20)

PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
PPT on Performance Review to get promotions
PPTX
Welding lecture in detail for understanding
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
additive manufacturing of ss316l using mig welding
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
Lecture Notes Electrical Wiring System Components
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPT on Performance Review to get promotions
Welding lecture in detail for understanding
CYBER-CRIMES AND SECURITY A guide to understanding
UNIT-1 - COAL BASED THERMAL POWER PLANTS
additive manufacturing of ss316l using mig welding
R24 SURVEYING LAB MANUAL for civil enggi
Foundation to blockchain - A guide to Blockchain Tech
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Model Code of Practice - Construction Work - 21102022 .pdf
bas. eng. economics group 4 presentation 1.pptx
Operating System & Kernel Study Guide-1 - converted.pdf
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Lecture Notes Electrical Wiring System Components
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Ad

The document provides an overview of the Arduino platform for beginners.

  • 2.  Microcontroller  CPU + ++++++++++  Microprocessor  CPU (on single chip) Microcontrollers 2
  • 3. What is a Microcontroller  Integrated chip that typically contains integrated CPU, memory (RAM ROM), I/O ports on a single Chip.  System on a single Chip/ small computer on a single chip  Designed to execute a specific task to control a single system  Smaller & Specified (design cost)  Differs from Microprocessor general-purpose chip Used to design multi purpose computers or devices Require Multiple chips to handle various tasks  Typically Microcontroller embedded inside some device  Microcontrollers are important part of Embedded systems 3
  • 4. What is a Development Board • A printed circuit board designed to facilitate work with a particular microcontroller. • Typical components include: • power circuit • programming interface • basic input; usually buttons and LEDs • I/O pins 4
  • 5. The Arduino Development Board 5 Arduino (The name is an Italian , meaning “strong friend”) is an open- source platform used for building electronics projects. Arduino consists of both a physical programmable circuit board (often referred to as a microcontroller) and a piece of software, or IDE (Integrated Development Environment) that runs on your computer, used to write and upload computer code to the physical board.
  • 6. Arduino Microcontroller Boards Microcontroller ATmega328 Operating Voltage 5 V Input Voltage (recommended) 7-12 V Input Voltage (limits) 6-20 V Digital I/O Pins 14 (of which 6 provide PWM output) Analog Input Pins 6 DC Current per I/O Pin 40 mA DC Current for 3.3V Pin 50 mA Flash Memory 32 KB (ATmega328) of which 2 KB used by bootloader SRAM 2 KB (ATmega328) EEPROM 1 KB (ATmega328) Clock Speed 16 MHz 6
  • 9. Microcontroller Ports and Pins  The communication channels through which information flows into or out of the microcontroller  Ex. PORTB  Pins PB0 – PB7  May not be contiguous  Often bi-directional C 9
  • 11. Setting the Pin Data Direction  Arduino  pinMode(pin_no., dir)  Ex. Make Arduino pin 3 (PD3) an output  pinMode(3, OUTPUT);  Note: one pin at a time  Suppose you wanted Arduino pins 3, 5, and 7 (PD3, PD5, and PD7) to be outputs?  Is there a way to make them all outputs at the same time?  Yes! Answer coming later… 11
  • 12. Atmega328 Overview 12 8-bit CPU Timer/Counter Internal memories  32KB Flash  1KB EEPROM  2KB SRAM Serial Peripheral Interface Universal Synchronous and Asynchronous serial Receiver and Transmitter (Serial) GPIO 2-wire Serial Interface
  • 13. AVR Microcontroller AVR stand for?  Advanced Virtual RISC, the founders are Alf Egil Bogen Vegard Wollan RISC AVR architecture was conceived by two students at Norwegian Institute of Technology (NTH) and further refined and developed at Atmel Norway (Atmel AVR). 13
  • 14. AVR Microcontroller  AVR Micro controllers is Family of RISC Microcontrollers from Atmel.  There are multiple architectures RISC (Reduced Instruction Set Computer) CISC (Complex Instruction Set Computer) 14
  • 15. RISC Microcontroller Reduced Instruction Set Computers Advantages  Fast Execution of Instructions due to simple instructions for CPU.  RISC chips require fewer transistors, which makes them cheaper to design and produce.  Emphasis on software  Single-clock , reduced instruction only  Register to register: “LOAD" and "STORE“ are independent instructions  Spends more transistors on memory registers 15
  • 17. The AVR is a Harvard architecture CPU.  Harvard Architecture  Computer architectures that used physically separate storage and signal pathways for their instructions and data.  CPU can read both an instruction and data from memory at the same time that makes it faster.  von Neumann architecture  CPU can Read an instruction or data from/to the memory.  Read, Write can`t occur at the same time due to same memory and signal pathway for data and instructions. AVR Microcontroller 17
  • 19. AVR Microcontroller  AVR is a family of 8-bit microntrollers with a large range of variants differing in: - size of program-memory (flash) - size of EEPROM memory - number of I/O pins - number of on-chip features such as UART and ADC  Smallest microcontroller is the ATTiny11 with 1k flash ROM, no RAM and 6 I/O pins.  Large such as the ATMEGA128 with 128k flash, 4KB RAM, 53 I/O pins and lots of on-chip features. 19
  • 21. AVR Architecture • Registers • Instruction Set • I/O ports • Memory (flash & RAM & ROM) • CPU 21
  • 22. AVR Architecture  Registers: Two types of registers GERNEL purpose & SPECIAL purpose registers  GERNEL purpose 32 general purpose registers having storage capacity of 8-Bits Named as R0,R1,R2 to R31. Register 0 to 15 & 16 to 31 are different. Can store both Data & Addresses.  SPECIAL purpose: Three registers Program counter Stack Pointer Status Register 22
  • 23. 23 AVR Memory Space • Program Flash – Vectors, Code, and (Unchangeable) Constant Data • Working Registers – Includes X, Y, and Z registers. • I/O Register Space – Includes “named” registers • SRAM – Data Space – Runtime Variables and Data – Stack space • EEPROM space – For non-volatile but alterable data
  • 24. AVR Architecture Pointer Register Three 16-bit address registers pairs of registers 26 to 31 have extra meaning in AVR assembly. X (r27:r26), y (r29:r28), z (r31:r30). pointer Sequence X Read/Write from address X, don't change the pointer 24
  • 25. AVR Architecture status register (SREG) It is 8-bit long each bit has a different meaning. I: Global Interrupt Enable/Disable Flag, SREG7 T: Transfer bit used by BLD and BST instructions, SREG6 H: Half Carry Flag, SREG5 S: For signed tests Instruction Set, SREG4 V: Two's complement overflow indicator, SREG3 N: Negative Flag, SREG2 Z: Zero Flag, SREG1 C: Carry Flag, SREG0 I Z T N H S V C 25
  • 26. AVR Architecture Stack Pointer (SP) 16-bit stack pointer (SP) holds address in data space of area to save function call information. 26
  • 28. AVR Architecture Memory: There are two separate memories Program Memory Data Memory 28
  • 29. AVR Studio  Integrated Development Environment (IDE) for writing and debugging AVR applications for windows environments.  AVR Studio provides a project management tool, source file editor, chip simulator and In-circuit emulator interface for the powerful AVR 8-bit RISC family of microcontrollers. 29