Introduction To AVR Microcontrollers: College of Engineering
Introduction To AVR Microcontrollers: College of Engineering
IENF641: Microcontrollers
Edited by:
Dr. Essam Alnatsheh
[email protected]
Topics
• Microcontrollers vs. Microprocessors
• Most common microcontrollers
• AVR Features
• AVR members
2
What is a Microcomputer?
General Purpose Microprocessors vs. Microcontrollers
• Microcontrollers
Microcontroller
I/O Serial
RAM ROM Timer
Port Port
CPU
Buses
4
What is a Microprocessor ?
Central Processing Unit
(CPU): Control the operation
of the computer and
performs its data processing CPU
functions; often simply
referred to as PROCESSOR
What is a Microcontroller?
Microprocessor vs. Microcontroller
Microprocessor vs. Microcontroller
Microprocessor Microcontroller
• A chip that contains only • A chip that contains all the
the processor components of a computer –
• Need other chips to make processor, memory, I/O, etc.
a working system
• designer can decide on • fix amount of on-chip ROM,
the amount of ROM, RAM, I/O ports
RAM and I/O ports. • for applications in which cost,
• Expansive power and space are critical
• general-purpose • single-purpose
Embedded System
• Embedded system means the microcontroller is embedded into
an application.
• An embedded product uses a microcontroller to do one task
only.
• In an embedded system, there is only one application software
that is typically burned into EEPROM.
• Example:printer, keyboard, video game player
List several reasons why microcontrollers are used
instead of PCs for some tasks?
• Cheaper,
• require less power,
• smaller,
• lighter,
• designed to run for years without re-starting.
Three Criteria in Choosing a Microcontroller
• 32-bit microcontrollers
– ARM
– AVR32
– PIC32
16
What does AVR RISC mean?
• AVR (1994)
→ 8 bit bus
→ one instruction per cycle
→ Harvard architecture
AVR 8-Bit RISC High Performance
• True single cycle execution
→ single-clock-cycle-per-instruction execution
→ PIC microcontrollers take 4 clock cycles per instruction
• One MIPS (mega instructions per second) per MHz
→ up to 20 MHz clock
• 32 general purpose registers
→ provide flexibility and performance when using high
level languages
→ prevents access to RAM
• Harvard architecture
→ separate bus for program and data memory
AVR 8-Bit RISC Low Power Consumption
• 1.8 to 5.5V operation
→ will use all the energy stored in
your batteries
• A variety of sleep modes
→ AVR Flash microcontrollers have
up to six different sleep modes
→ fast wake-up from sleep modes
• Software controlled frequency
AVR 8-Bit RISC Compatibility
• AVR® Flash microcontrollers share a single core
architecture
→ use the same code for all families
→ 1 Kbytes to 256 Kbytes of code
→ 8 to 100 pins
→ all devices have
Internal oscillators
AVR 8-Bit RISC - picoPower Technology
28 pin
(PCINT14/RESET) PC6 1 28 PC5 (ADC5/SCL/PCINT13)
(PCINT16/RXD) PD0 2 RAM EEPROM
27 Timers
PC4 (ADC4/SDA/PCINT12)
(PCINT17/TXD) PD1 3 26 PC3 (ADC3/PCINT11)
PROGRAM
(PCINT18/INT0) PD2 4 MEGA328 25 PC2 (ADC2/PCINT10)
ROM
(PCINT19/OC2B/INT1) PD3 5 24 PC1 (ADC1/PCINT9)
Program
(PCINT20/XCK/T0) PD4 6 23 PC0 (ADC0/PCINT8)
Bus VCC
Bus 7 22 GND
CPU
GND 8 21 AREF
(PCINT6/XTAL1/TOSC1) PB6 9 20 AVCC
(PCINT7/XTAL2/TOSC2) PB7 10 19 PB5 (SCK/PCINT5)
(PCINT21/OC0B) PD5 11 18 PB4 (MISO/PCINT4)
(PCINT22/OC0A/AIN0) PD6 12 17 PB3 (MOSI/OC2A/PCINT3)
(PCINT23/AIN1) PD7 13
Interrupt 16 Other
PB2 (SS/OC1B/PCINT2)
OSC Ports
(PCINT0/CLKO/ICP1) PB0 14 Unit 15 Peripherals
PB1 (OC1A/PCINT1)
I/O
PINS
27
AVR different groups
• Classic AVR
– e.g. AT90S2313, AT90S4433
• Mega
– e.g. ATmega328, ATmega32, ATmega128
• Tiny
– e.g. ATtiny13, ATtiny25
• Special Purpose AVR
– e.g. AT90PWM216,AT90USB1287
• XMega
– New features like DMA, DAC, crypto engine, etc.
28
Naming Convention
ATtiny4 AT90S4
Atmel
Tiny Flash =4K Atmel Classic
Flash =4K
group group
Atmel AVR Atmega16 Microcontroller
Architecture of Atmega16
Applications
• AVR controllers come with a wide range of
applications where automation is required.
• Following are the main applications of Atmega16:
– Medical equipment
– Home automation
– Embedded systems
– Arduino Projects
– Used in automobiles and industrial automation
– Home appliances and security systems
– Temperature and pressure control devices
References