Académique Documents
Professionnel Documents
Culture Documents
Microcontroller System
Introduction to Microcontroller
HENDAWAN SOEBHAKTI, ST., MT.
Topics
1. Introduction
2. Microcontroller architecture
3. Arduino
1. Introduction
What is microcontroller?
Microcontroller is an integrated chip that
typically containts integrated CPU, memory
(RAM, ROM), I/O ports on a single chip.
Microcontroller is designed to execute a
specific task to control a single system.
Differs from microprocessor :
General purpose chip, require multiple chip to
handle various tasks.
4
Microcontroller vs Microprocessor
General Purpose Microprocessors
Data BUS
General
Purpose
Micro
processor
RAM
ROM
Timer
Serial
COM
Port
IO
Port
Address BUS
Control BUS
Microcontrollers
CPU
RAM
ROM
Serial
Port
Timer
I/O
5
Microcontroller Type
8-bit microcontrollers
AVR
PIC
HCS12
8051
32-bit microcontrollers
ARM
PIC32
6
AVR Microcontroller
AVR = Advanced Virtual RISC.
RISC = Reduced Instruction Set Computer.
The founder are Alf Egil Bogen and Vegard
Wollan, students at Norwegian Institute of
Technology on 1994.
Mega
e.g. ATmega8, ATmega32, ATmega128
Tiny
e.g. ATtiny13, ATtiny25
10
11
12
ATtiny44
Atmel
Tiny
group
Flash =4K
group
Flash =128K
AT90S4433
Atmel
Classic
group
Flash =4K
13
2. Microcontroller
Architecture
14
15
VCC
Digital supply voltage.
GND
Ground.
Port B (PB7:0) XTAL1/XTAL2/TOSC1/TOSC2
Port B is an 8-bit bi-directional I/O port with internal pull-up resistors.
Depending on the clock selection fuse settings, PB6 can be used as input
to the inverting Oscillator amplifier and input to the internal clock
operating circuit.
Depending on the clock selection fuse settings, PB7 can be used as output
from the inverting Oscillator amplifier.
If the Internal Calibrated RC Oscillator is used as chip clock source, PB7..6
is used as TOSC2..1 input for the Asynchronous Timer/Counter2 if the AS2
bit in ASSR is set.
16
Port C (PC5:0)
Port C is a 7-bit bi-directional I/O port with internal pull-up resistor.
PC6/RESET
If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin.
If RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low
level on this pin for longer than the f the minimum pulse length will
generate a Reset, even if the clock is not running.
Port D (PD7:0)
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors.
AVCC
AVCC is the 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. Note that PC6..4 use digital supply voltage, VCC.
17
AREF
AREF is 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
18
Block Diagram
Features :
32K bytes of In-System Programmable Flash
1K bytes EEPROM
2K bytes SRAM
23 programmable I/O lines
Two 8 bit Timers/Counters
One 16 bit Timer/Counter
Six PWM channels
6 channels 10 bit ADC
External and internal interrupts
Programmable serial USART
19
3. Arduino
20
Arduino
Arduino is a single board microcontroller to
make using electronics in multidisciplinary
project more accessible.
The hardware consists of an open-source
hardware board designed araound and an 8
bit Atmel AVR or a 32 bit Atmel ARM.
Arduino started in 2005 as a project for
students at the Design Instutute of Ivrea, Italy.
21
Uno
Duemilanove
Nano
Leonardo
Mega
22
Specs Compare
Name
Uno
Due
Leonardo
Mega 2560
Mega ADK
Micro
Mini
Nano
Ethernet
Esplora
ArduinoBT
Fio
Pro (168)
Pro (328)
Pro Mini
LilyPad
LilyPad USB
LilyPad
Simple
LilyPad
SimpleSnap
Processor
ATmega328
AT91SAM3X8E
ATmega32u4
ATmega2560
ATmega2560
ATmega32u4
ATmega328
ATmega168
ATmega328
ATmega328
ATmega32u4
ATmega328
ATmega328P
ATmega168
ATmega328
ATmega168
ATmega168V
ATmega328V
ATmega32u4
ATmega328
ATmega328
Operating
Voltage/Input
Voltage
5 V/7-12 V
3.3 V/7-12 V
5 V/7-12 V
5 V/7-12 V
5 V/7-12 V
5 V/7-12 V
5 V/7-9 V
CPU
Speed
Analog
In/Out
Digital
IO/PWM
EEPROM
[KB]
SRAM
[KB]
Flash
[KB]
16 Mhz
84 Mhz
16 Mhz
16 Mhz
16 Mhz
16 Mhz
16 Mhz
6/0
12/2
12/0
16/0
16/0
12/0
8/0
14/6
54/12
20/7
54/15
54/15
20/7
14/6
8/0
14/6
Mini-B
5 V/7-12 V
5 V/7-12 V
5 V/2.5-12 V
3.3 V/3.7-7 V
3.3 V/3.35-12 V
5 V/5-12 V
3.3 V/3.35-12 V
5 V/5-12 V
2.7-5.5 V/2.75.5 V
3.3 V/3.8-5V
2.7-5.5 V/2.75.5 V
2.7-5.5 V/2.75.5 V
16 Mhz
16 Mhz
16 Mhz
8 Mhz
8 Mhz
16 Mhz
8 Mhz
16Mhz
6/0
6/0
8/0
6/0
6/0
14/4
14/6
14/6
14/6
14/6
32
512
32
256
256
32
32
16
32
32
32
32
32
16
32
1
4
1
4
4
1
-
16 Mhz
2
96
2.5
8
8
2.5
2
1
2
2
2.5
2
2
1
2
Regular
2 Micro
Micro
Regular
Regular
Micro
-
5 V/7-9 V
1
1
4
4
1
1
0.512
1
1
1
1
1
0.512
1
Regular
Micro
Mini
-
1
1
1
1
6/0
14/6
0.512
16
8 Mhz
6/0
14/6
0.512
16
8 Mhz
4/0
9/4
2.5
32
Micro
8 Mhz
4/0
9/4
32
8 Mhz
4/0
9/4
32
USB
UART
23
Arduino Shield
Protoboard shield
Adafruit motor shield
24
Arduino Uno
: ATmega328
Operating Voltage
: 5V
: 7-12V
: 6-20V
:6
: 40 mA
: 50 mA
SRAM
: 2 KB (ATmega328)
EEPROM
: 1 KB (ATmega328)
Clock Speed
: 16 MHz
26
Schematic Diagram
27
Power
The Arduino Uno can be powered via the USB
connection or with an external power supply. The
power source is selected automatically.
External (non-USB) power can come either from an
AC-to-DC adapter (wall-wart) or battery.
The board can operate on an external supply of 6 to 20
volts. If supplied with less than 7V, however, the 5V pin
may supply less than five volts and the board may be
unstable. If using more than 12V, the voltage regulator
may overheat and damage the board. The
recommended range is 7 to 12 volts.
28
Power (2)
29
Memory
The ATmega328 has 32 KB (with 0.5 KB used
for the bootloader). It also has 2 KB of SRAM
and 1 KB of EEPROM (which can be read and
written with the EEPROM library).
30
Analog Inputs
The Uno has 6 analog inputs, labeled A0
through A5, each of which provide 10 bits
of resolution (i.e. 1024 different values).
By default they measure from ground to 5
volts, though is it possible to change the
upper end of their range using the AREF pin
and the analogReference() function.
Additionally, some pins have specialized
functionality:
TWI: A4 or SDA pin and A5 or SCL pin.
Support TWI communication using the Wire
library.
33
Other Pins
AREF. Reference voltage for the analog inputs.
Used with analogReference().
Reset. Bring this line LOW to reset the
microcontroller. Typically used to add a reset
button to shields which block the one on the
board.
34
Communications
35
Software
36
37
It is a feature of most Arduino boards that they have an LED and load
resistor connected between pin 13 and ground; a convenient feature for
many simple tests.
38
Any Question?
39