Embedded Systems
Engr. Rashid Farid Chishti
e-mail:
[email protected] Chapter 01: The AVR Microcontroller:
History and Features
International Islamic University H-10, Islamabad, Pakistan
http://www.iiu.edu.pk
General Purpose Microprocessors vs. Microcontrollers
Microprocessor
No RAM, ROM, I/O Ports on chip itself
e.g. Pentium (Intel), PowerPC (Motorola), Spark (SUN)
Applications: Desktop, Laptop, workstations, Servers
Microcontroller
Microprocessor, RAM, ROM, timers, I/O Ports on a single
chip.
8051(Intel), 68HC08 (Motorola), AVR (Atmel), Z8 (Zilog),
PIC (Microchip), ARM (Advanced RISC Machine).
Application: TV Remote Control, video games, robots,
General Purpose Microprocessors vs. Microcontrollers
Data BUS
General Serial
IO
Purpose RAM ROM Timer COM
Port
Micro Port
processor Address BUS
Control BUS
General Purpose Microprocessors
CPU RAM ROM
Serial
Timer I/O
Port
Microcontrollers
ARM , Motorola 68K, PowerPC, PIC32
8-bit Microcontrollers are 32-bit µC
Table 1-6: Some of the Companies that Produce Widely Used 8-bit Microcontrollers
Company Web Site Architecture
Atmel http://www.atmel.com AVR and 8051
Microchip http://www.microchip.com PIC16xxx/18xxx
Intel http://www.intel.com/design/mcs51 8051
Philips/Signetics http://www.semiconductors.philips.com 8051
Zilog http://www.zilog.com Z8 and Z80
Dallas Semi/Maxim http://www.maxim-ic.com 8051
Freescale Semi http://freescale.com 68HC11/HCS08
Table 1-7: Comparison of 8051, PIC18 Family and AVR (40-pin package)
Feature 8052 PIC18F452 ATmega32
Program ROM 8K 32K 32K
Data RAM (maximum space) 256 bytes 2K 2K
EEPROM 0 bytes 256 bytes 1K
Timers 3 4 4
I/O Pins 32 35 32
Embedded Systems
An embedded system is controlled by its own
internal microprocessor (or microcontroller)
as opposed to an external controller.
A PC is connected to various embedded
products such as keyboard, printer, modem,
disk controller, sound card, CD-ROM driver,
mouse and so on.
a printer gets data and prints it. A mouse
takes coordinates and sends to the PC.
Embedded Products
Computing Cars Communications
PC Anti-lock breaks Wire-line
Air bags Phone
Notebook
Engine Control Cellular
Laptop Phones
Storage Transmission
Control PDA
Color printer Climate control Pager
Laser printer Collusion Fax machine
Modem avoidance Intercom
Cable modem Navigation Cards
Copier Trip Computer Banking
Scanner Instrumentation Electronic
Keyless entry Purse
Digital camera
Social Security
Tolls
Embedded Products
Consumer Consumer Connectivity
VCR, CD Toys Cable TV
Video games Answering Cable Modem
machine Router
DVD Player Camcorder Switch
Stereo Musical Hub
Smoke alarm Instruments
Firewall
Sewing
Camera Machine
Remote Control Exercise
Garage Door equipment
Opener
Security System
Choosing a microcontroller
Speed: What is the highest speed a microcontroller
supports?
Packaging: Is it DIP (dual inline package) or a QFP
(quad flat package) or some other type?
Power Consumption: Critical for battery powered
products.
The amount of RAM and ROM on chip
The number of timers and I/O pins on chip
Cost per unite
Availability of Compiler, Simulator, Debugger.
Availability of chip in market
The AVR microcontroller Family
The basic architecture of AVR was designed
by two students of Norwegian Institute of
Technology (NTH), Alf-Egil Bogen and
Vegard Wollan, and then was bought and
developed by Atmel in 1996.
The AVR stands for Advanced Virtual RISC,
or Alf and Vegard RISC.
The AVR is an 8-bit RISC single-chip
microcontroller with Harvard architecture.
RISC and CISC
CISC(Complex Instruction Set Computer)
A large number of instructions, typically from 100 to 250
instructions
Some instructions that perform specialized task and are used
infrequently
A large variety of addressing modes, typically from 5 to 20
different modes
Variable-length instruction formats
RISC(Reduced Instruction Set Computer)
Relatively few instructions
Relatively few addressing modes
Fixed-length, easily decoded instruction format
Harvard and von Neumann Architecture
von Neumann (Princeton) architecture.
The same bus is used for accessing both the code and data
Pentium Processor is based on von Neumann Architecture
Harvard architecture
Separate buses are used for accessing the code and data
memory.
That means that we need four sets of buses:
1. A set of data buses for carrying data into and out of the CPU,
2. A set of address buses for accessing the data,
3. A set of data buses for carrying code into the CPU, and
4. An address bus for accessing the code
This is easy to implement inside an IC chip such as a
microcontroller where both ROM code and data RAM are
internal (on-chip) and distances are on the micron and millimeter
scale
Harvard and von Neumann Architecture
Data bus Data bus
Code Data
Memory Address bus CPU Address bus Memory
Control bus Control bus
Harvard architecture
Code Data
Memory Memory
Data bus
CPU Address bus
Control bus
Von Neumann architecture
The AVR microcontroller Family
40 PIN DIP
(XCK/T0) PB0 1 40 PA0 (ADC0)
(T1) PB1 2 39 PA1 (ADC1)
(INT2/AIN0) PB2 3 38 PA2 (ADC2)
RAM EEPROM Timers (OC0/AIN1) PB3 4 MEGA32 37 PA3 (ADC3)
(SS) PB4 5 36 PA4 (ADC4)
PROGRAM (MOSI) PB5 6 35 PA5 (ADC5)
(MISO) PB6 7 34 PA6 (ADC6)
Flash ROM
(SCK) PB7 8 33 PA7 (ADC7)
RESET 9 32 AREF
Program Data VCC 10 31 AGND
Bus Bus GND 11 30 AVCC
CPU XTAL2 12 29 PC7 (TOSC2)
XTAL1 13 28 PC6 (TOSC1)
(RXD) PD0 14 27 PC5 (TDI)
(TXD) PD1 15 26 PC4 (TDO)
(INT0) PD2 16 25 PC3 (TMS)
(INT1) PD3 17 24 PC2 (TCK)
(OC1B) PD4 18 23 PC1 (SDA)
Interrupt Other (OC1A) PD5 19 22 PC0 (SCL)
OSC Ports
Unit Peripherals (ICP) PD6 20 21 PD7 (OC2)
I/O
PINS
The Simplified view of an AVR Microcontroller
The AVR Family
The AVR can be classified into 4 groups: 32-Bit, XMega, Mega,
and Tiny AVR MCU.
32-bit AVR (AT32xxxxxxx)
These are the world's most efficient 32-bit MCU.
Program memory: 16K to 512K bytes
Package: 48 to 144 pins
Operating Frequency: Up to 66 MHz
Performance: 1.5 MIPS/MHz
XMega AVR (ATxmegaxxxx)
The Atmel AVR XMEGA A series is the most performance
oriented series within its family
Program memory: 16K to 384K bytes
Package: 32 to 100 pins
Operating Frequency: Up to 32 MHz
Performance: 1.0 MIPS/MHz
The AVR Family
Mega AVR (ATmegaxxxx)
These are powerful microcontrollers with more than 120 instructions
and lots of different peripheral capabilities, which can be used in
different designs. Some of their characteristics are as follows:
Program memory: 4K to 256K bytes
Package: 28 to 100 pins
Operating Frequency: Up to 20 MHz
Performance: 1.0 MIPS/MHz
Tiny AVR (ATtinyxxxx)
This group have less instructions and smaller packages in
comparison to mega family. You can design systems with low costs
and power consumptions using the Tiny AVRs. Some of their
characteristics are as follows:
Program memory: 0.5K to 8K bytes
Package: 6 to 32 pins
Operating Frequency: Up to 20 MHz
Performance: 1.0 MIPS/MHz
The AVR Family
Table 1-3: Some Members of the ATmega Family
Part Number Code Data Data I/O pins ADC Timers
ROM RAM EEPROM
ATmega8 8K 1K 512 byte 23 8 3
ATmega16 16K 1K 512 bye 32 10 3
ATmega32 32K 2K 1K 32 10 3
ATmega64 64K 4K 2K 54 10 4
ATmega128 128K 8K 4K 86 10 6
All the above chips have USART for serial data transfer
The AVR Family
Table 1-4: Some Members of the Tiny Family
Part Number Code Data Data I/O ADC Timers
ROM RAM EEPROM Pins
ATtiny13 1K 64 64 6 4 1
ATtiny25 2K 128 128 6 4 2
ATtiny44 4K 256 256 12 8 2
ATtiny84 8K 512 512 12 8 2
Let’s get familiar with the AVR part numbers
ATxmega64A1 ATmega128
Atmel xmega Atmel group
Flash =64K Flash =128K
group
AT32UC3L0256
ATtiny44
Atmel 32-bit
Flash =256K
Atmel group
Tiny Flash =4K
group