Professional Documents
Culture Documents
Pradeep Kumar
Why Microcontrollers ??
Functional Requirements
Device
Device ON Temperature < 60 deg C
3/26/2010 2
Pradeep Kumar
Why do we need to learn
Microprocessors/controllers?
• The microprocessor is the core of computer
systems.
• Nowadays many communication, digital
entertainment, portable devices, are controlled
by them.
• A designer should know what types of
components he needs, ways to reduce
production costs and product reliable.
3/26/2010 3
Pradeep Kumar
Different aspects of a microprocessor/controller
3/26/2010 4
Pradeep Kumar
The necessary tools for a
microprocessor/controller
• CPU: Central Processing Unit
• I/O: Input /Output
• Bus: Address bus & Data bus
• Memory: RAM & ROM
• Timer
• Interrupt
• Serial Port
• Parallel Port
3/26/2010 5
Pradeep Kumar
Basic Components of Digital Computer
• CPU
• Memory
• I/O
Memory
CPU
I/O
Could be a chip, a
board, or several
boards
3/26/2010 6
Pradeep Kumar
Microprocessors:
General-purpose microprocessor
• CPU for Computers
• No RAM, ROM, I/O on CPU chip itself
• Example:Intel’s x86, Motorola’s 680x0
3/26/2010 7
Pradeep Kumar
Microcontrollers
Memory
CPU
I/O
Subsystems:
Timers, Counters, Analog
A single chip Interfaces, I/O interfaces
3/26/2010 8
Pradeep Kumar
•
Microcontroller
A smaller computer
:
• On-chip RAM, ROM, I/O ports...
• Example:Motorola’s 6811, Intel’s 8051, Zilog’s Z8 and PIC 16X
3/26/2010 9
Pradeep Kumar
Microcontrollers versus Microprocessors
3/26/2010 10
Pradeep Kumar
Microprocessor vs. Microcontroller
Microprocessor Microcontroller
• CPU is stand-alone, RAM, • CPU, RAM, ROM, I/O and
ROM, I/O, timer are separate timer are all on a single chip
• designer can decide on the
• fix amount of on-chip ROM,
amount of ROM, RAM and I/O
ports.
RAM, I/O ports
• expansive • for applications in which cost,
• versatility
power and space are critical
• general-purpose • single-purpose
3/26/2010 11
Pradeep Kumar
Embedded System
• Embedded system means the processor is embedded into that
application.
• An embedded product uses a microprocessor or microcontroller to do
one task only.
• In an embedded system, there is only one application software that is
typically burned into ROM.
• Example:printer, keyboard, video game player
3/26/2010 12
Pradeep Kumar
CISC, RISC
• Microcontrollers with Harvard architecture are also
called "RISC microcontrollers". RISC stands for
Reduced Instruction Set Computer.
3/26/2010 13
Pradeep Kumar
3/26/2010 14
Pradeep Kumar
Real Time Control
3/26/2010 15
Pradeep Kumar
Common Microcontrollers
•Atmel •Motorola
•ARM •8-bit
•Intel •68HC05
•8-bit •68HC08
•8XC42 •68HC11
•MCS48 •16-bit
•MCS51 •68HC12
•8xC251 •68HC16
•16-bit •32-bit
•MCS96 •683xx
•MXS296 •Texas Instruments
•National Semiconductor •TMS370
•COP8 •MSP430
•Microchip •Zilog
•12-bit instruction PIC •Z8
•14-bit instruction PIC •Z86E02
•PIC16F84
•16-bit instruction PIC
•NEC
3/26/2010 16
Pradeep Kumar
Three criteria in Choosing a Microcontroller
3/26/2010 17
Pradeep Kumar
Embedded Systems
3/26/2010 18
Pradeep Kumar
Definitions
• Embedded system – Almost any
special-purpose computer
– I.e. not a PC, workstation, or server box
• Microprocessor – regular CPU
• Microcontroller – small system on a
chip, contains extra logic to help talk to
the real world
– A/D and D/A
– PWM
– UARTs, SPI, CAN, USB, etc…
3/26/2010 19
Pradeep Kumar
Embedded Characteristics
3/26/2010 20
Pradeep Kumar
More Characteristics
3/26/2010 21
Pradeep Kumar
Important Difference
• Platform is known in advance
– This is good: App can be tailored very specifically to
platform
– This is bad: All this tailoring is hard work
3/26/2010 22
Pradeep Kumar
CPU Design Space
• Custom hardware
– May be no software at all
• 4-bit microcontroller
– Few bytes of RAM
– No OS
– Software all in assembly
– These are getting less popular
3/26/2010 23
Pradeep Kumar
CPU Design Space
• 8-bit microcontroller
– A few bytes to a few hundred KB of RAM
– At the small end software is in asm, at the high
end C, C++, Java
– Might run a home-grown OS, might run a
commercial RTOS
– Typically costs a few $$
3/26/2010 24
Pradeep Kumar
CPU Design Space
3/26/2010 25
Pradeep Kumar
Sources of Variation
• Power
1. Must run for years on a tiny battery (hearing
aid, pacemaker)
2. Unlimited power (ventilation control)
• Real-time
1. Great harm is done if deadlines are missed
(avionics)
2. Few time constraints (microwave)
3/26/2010 26
Pradeep Kumar
More Variation
• Importance
1. Device is safety critical (nuclear plant)
2. Failure is irrelevant (greeting card, electric
toothbrush)
• Upgradability
– Impossible to update (spacecraft, pacemaker)
– Easily updated (firmware in a PC network card)
3/26/2010 27
Pradeep Kumar
More Variation
• Cost sensitivity
1. A few % in extra costs will kill profitability (many
products)
2. Cost is largely irrelevant (military applications)
3/26/2010 28
Pradeep Kumar
Programming Languages
• Assembler
– No space overhead
– Good programmers write fast code
– Non-portable
– Hard to debug
• C
– Little space and time overhead
– Somewhat portable
– Good compilers exist
3/26/2010 29
Pradeep Kumar
More Languages
• C++
– Often used as a “better C”
– Low space and time overhead if used
carefully
• Java
– More portable
– Full Java requires lots of RAM
– J2ME popular on cell-phone types of
devices
– Bad for real-time!
3/26/2010 30
Pradeep Kumar
RTOS
3/26/2010 31
Pradeep Kumar
What’s Hard?
3/26/2010 32
Pradeep Kumar
Some Tradeoffs
3/26/2010 33
Pradeep Kumar
Creating Embedded SW
1. Pick:
Cheapest CPU that seems like it’ll work
Appropriate language
Appropriate OS
Appropriate software architecture
2. Code… test… repeat
3/26/2010 34
Pradeep Kumar
Common features of Embedded Systems
•Is a microprocessor based system.
•Built into a device to control a function or a range of functions.
•Not designed to be programmed by the end-user (i.e. like a PC).
•Executes an in-built single program repeatedly
•Tight coupling between hardware and software.
•Designed to work in highly constrained environments.
•Low cost, low power, small, fast, etc.
•Reactive and real-time
•Continually reacts to changes in the system’s environment
•Must compute certain results in real-time without delay
3/26/2010 35
Pradeep Kumar
Why use Embedded Systems
•Replacements for discrete-logic based systems.
•To provide functional upgrades.
•To provide easy maintenance upgrades.
•Improve mechanical performance.
•Protection of intellectual property.
•Flexibility in design.
•Re-usable hardware designs / circuits.
•Replacements for analog circuits.
3/26/2010 36
Pradeep Kumar
An Embedded System Example
3/26/2010 37
Pradeep Kumar
Processor technology
3/26/2010 38
Pradeep Kumar
Processor technology
3/26/2010 39
Pradeep Kumar
General-purpose processors
3/26/2010 40
Pradeep Kumar
Single-purpose processors
3/26/2010 41
Pradeep Kumar
Application-specific processors
3/26/2010 42
Pradeep Kumar
IC technology
Three types of IC technologies
• Full-custom/VLSI
• Semi-custom ASIC (gate array and standard
cell)
• PLD (Programmable Logic Device)
3/26/2010 43
Pradeep Kumar
Full-custom/VLSI
• All layers are optimized for an embedded system’s
particular digital implementation
• Placing transistors
• Sizing transistors
• Routing wires
• Benefits
• Excellent performance, small size, low power
• Drawbacks
• High NRE cost (e.g., $300k), long time-to-market
• Effective only with large quantities
3/26/2010 44
Pradeep Kumar
Semi-custom
• Lower layers are fully or partially built
• Designers are left with routing of wires and maybe
placing some blocks
• Benefits
• Good performance, good size, less NRE cost than
a full-custom
• implementation (perhaps $10k to $100k)
• Drawbacks
• Still require weeks to months to develop – but
faster tools are emerging
• Examples
• CPLDs
3/26/2010 45
Pradeep Kumar
PLD (Programmable Logic Device)
• All layers already exist
• Designers can purchase an IC
• Connections on the IC are either created or destroyed
• to implement desired functionality
• Field-Programmable Gate Array (FPGA) very popular
• Benefits
• Low NRE costs, almost instant IC availability
• Drawbacks
• Bigger, expensive (perhaps $30 per unit), power
hungry, slower
3/26/2010 46
Pradeep Kumar