Es Arduino 2
Es Arduino 2
Introduction to Microcontrollers
1
Microcontrollers
Microcontroller
CPU + ++++++++++
Microprocessor
2
What is a Microcontroller
Integrated chip that typically contains integrated CPU, memory (RAM
ROM), I/O ports on a single Chip.
5
Arduino Microcontroller Boards
6
Microcontroller ATmega328
Operating Voltage 5V
Input Voltage
7-12 V
(recommended)
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
32 KB (ATmega328) of which 2 KB used by
Flash Memory
bootloader
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)
Clock Speed 16 MHz
ATmega328 Internal Architecture
7
ATmega328 Microcontroller
Pin number
Pin name
Special
function
8
Microcontroller Ports and Pins
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);
11
Atmega328 Overview
Internal
memories
32KB Flash
1KB EEPROM
2KB SRAM
8-bit CPU
Timer/Counter
Serial Peripheral
Universal Synchronous Interface
and Asynchronous
serial Receiver and
Transmitter (Serial)
12
AVR Microcontroller
13
AVR Microcontroller
14
RISC Microcontroller
15
On Chip
Debugger
Two Wire
Interface
16
AVR Microcontroller
The AVR is a Harvard architecture CPU.
Harvard Architecture
17
AVR Microcontroller
Harvard Architecture
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.
23
AVR Architecture
Pointer Register
pointer Sequence
Read/Write from address X,
X
don't change the pointer
24
AVR Architecture
status register
(SREG) It is 8-bit long each bit has a different meaning.
I T H S V N Z C
25
AVR Architecture
26
AVR
Register Architecture
27
AVR Architecture
Memory:
Program Memory
Data Memory
28
AVR Studio
29