Chapter one
Fundamentals of
Microprocessors and
Microcontroller
Contents
Introduction to the microprocessor and micro-
controller
Types of memory
Input/output module (analog and digital )
A little History
What is a computer?
[Merriam-Webster Dictionary] one that
computes; specifically : programmable
electronic device that can store, retrieve, and
process data.
[Wikipedia] A computer is a machine that
manipulates data according to a list of
instructions.
Microcomputer system
Basic functions of parts of microcomputer
system
Input – accepts coded information from human
operators, from electromechanical devices (such
as keyboards), or from other digital medium via
digital communication lines.
The information received is either stored in the
memory or immediately used by the arithmetic
and logic unit (ALU) to perform the desired
operations.
The results are sent back out through the output
medium.
All actions are coordinated through the control
unit.
Classification of Computers (power and price)
Personal computers
Mainframes
Supercomputers
Dedicated controllers – Embedded controllers
Mainframes
Massive amounts of memory
Use large data words…64 bits or greater
Mostly used for military defense and large
business data processing
Examples: IBM 4381, Honeywell DPS8
Personal Computers
Any general-purpose computer
intended to be operated directly by an end user
Range from small microcomputers that work with 4-bit words
to PCs working with 32-bit words or more
They contain a Processor - called different names
Microprocessor – built using Very-Large-Scale
Integration technology; the entire circuit is on a
single chip
Central Processing Unit (CPU)
Microprocessor Unit (MPU) – similar to CPU
Supercomputers
Fastest and most powerful mainframes
Contain multiple central processors (CPU)
Used for scientific applications, and number crunching
Now have teraflops performance
FLoating Point Operations Per Second (FLOPS)
Used to measure the speed f the computer
Examples of special-purpose supercomputers:
Belle, Deep Blue, and Hydra, for playing chess
Reconfigurable computing machines or parts of machines
GRAPE, for astrophysics and molecular dynamics
Deep Crack, for breaking the DES cipher
MDGRAPE-3, for protein structure computation
Microcontrollers –
Embedded Systems
An embedded system is a special-purpose computer
system designed to perform one or a few dedicated
functions often with real-time
An integrated device which consists of multiple devices
Microprocessor (MPU)
Memory
I/O (Input/Output) ports
Often has its own dedicated software
A little about
Microprocessor-based
Systems ……
A microprocessor - also known as a CPU or
central processing unit - is a complete
computation engine that is fabricated on a single
chip. The first microprocessor was the Intel
4004, introduced in 1971. The 4004 was not
very powerful - all it could do was add and
subtract, and it could only do that 4 bits at a
time. But it was amazing that everything was on
one chip. Prior to the 4004, engineers built
computers either from collections of chips or
from discrete components (Transistors and
such). The 4004 powered one of the first
portable electronic calculators.
Evolution
First came transistors
Integrated circuits
SSI (Small-Scale Integration) to ULSI
Very Large Scale Integration circuits (VLSI)
1- Microprocessors (MPU)
Microcomputers (with CPU being a microprocessor)
Components: Memory, CPU, Peripherals (I/O)
Example: Personal computers
2- Microcontroller (MCU)
Microcomputers (with CPU being a microprocessor)
Many special function peripheral are integrated on a single
circuit
Types: General Purpose or Embedded System (with special
functionalities)
Microprocessor-Based Systems
• Central Processing Unit (CPU)
• Memory
• Input/Output (I/O) circuitry
• Buses
– Address bus
– Data bus
– Control bus
MPU
GP-
CLK Reg
CPU
CPU
Arithmetic
Register Microprocessor-based System
Logic
Arrays
Unit
Control Unit
Buses: Address, Data, and Control
Bus Structure
Bus - a group of parallel wires that transfer
information from one part of the computer to
another.
Control Bus
synchronizes the actions of all of the
devices attached to the system bus.
Address Bus
passes the addresses of instructions and
data between the CPU and memory (or I/O).
Data Bus
transfers instructions and data between the
CPU and memory (or I/O).
The three components – MPU, memory, and I/O – are connected by a
group of wires called the BUS
Address bus
consists of 16, 20, 24, or 32 parallel signal lines (wires) - unidirectional
these lines contain the address of the memory location to read or written
Control bus
consists of 4 to 10 (or more) parallel signal lines
CPU sends signals along these lines to memory and to I/O ports
examples: Memory Read, Memory Write, I/O Read, I/O Write
Data bus
consists of 8,16, or 32 parallel signal lines
bi-directional
only one device at a time can have its outputs enabled,
this requires the devices to have three-state output
Microprocessor
The microprocessor (MPU) is a computing and
logic device that executes binary instructions in a
sequence stored in memory.
Characteristics:
General purpose central processor unit (CPU)
Binary
Register-based
Clock-driven
Programmable
Microprocessor
the “brains” of the computer
its job is to fetch instructions, decode them, and then execute them
8/16/32/etc –bit (how it moves the data
contains:
Arithmetic
Register
Logic
Arrays
Unit
Control Unit
Inside the CPU
Control Unit (CU)
coordinates the sequencing of steps
involved in executing machine instructions
Arithmetic Logic Unit (ALU)
performs arithmetic and logical operations
Registers
storage locations
Clock
synchronizes the internal operations of the
CPU with the other system components
Memory
Memory is a group of registers
16 register – address: 0-15 – in binary: 0-
1111; Address lines: A0-A3
Serves two major purposes
storing the binary codes for the sequence of
instructions specified by programs (program)
storing binary data that the computer needs
to execute instructions (data)
Memory Types
R/W: Read/Write Memory; also called RAM
It is volatile (losses information as power is removed)
Write means the processor can store information
Read means the processor can receive information from
the memory
Acts like a Blackboard!
ROM: Read-Only memory;
It is typically non-volatile (permanent) – can be erasable
It is similar to a Page from your textbook
Memory Classification
Expensive Cheap
Onetime programmable
Fast/ Slow
Electronically Erasable
PROM
Erasable ROMs
Marked Programmed ROM
Programmed by the manufacturer
Programmable ROM (PROM)
Can be programmed in the field via the programmer
Erasable Programmable ROM (EPROM)
Uses ultraviolet light to erase (through a quartz window)
OTP refers to one-time programmable
Electrically Erasable Programmable ROM (EEPROM)
Each program location can be individually erased
Expensive
Requires programmer
FLASH
Can be programmed in-circuit (in-system)
Easy to erase (no programmer)
Only one section can be erased/written at a time (typically 64 bytes at a time)
I/O Ports
The way the computer communicates with the
outside world devices
I/O ports are connected to Peripherals
Peripherals are I/O devices
Input devices
Output devices
Examples
Printers and modems,
keyboard and mouse
scanner
Universal Serial Bus (USB)
So what are
microcontrollers?
First Microcontrollers
IBM started using Intel processors in its PC
Intel started its 8042 and 8048 (8-bit
microcontroller) – using in printers
Apple Macintosh used Motorola
1980 Intel abandoned microcontroller business
By 1989 Microchip was a major player in
designing microcontrollers
PIC: Peripheral Interface Controller
Embedded controllers
Used to control smart machines
Examples: printers, auto braking systems
Also called microcontrollers or
microcontroller units (MCU)
Embedded controllers
Software Characteristics
No operating systems
Execute a single program, tailored exactly to the
controller hardware
Assembly language (vs. High-level language)
Not transportable, machine specific
Programmer need to know CPU architecture
Speed
Program size
Uniqueness
Microcontroller Unit (MCU)
Definition
- An integrated electronic computing and logic device that
includes three major components on a single chip
Microprocessor
Memory
I/O ports
It Includes support devices
Timers
A/D converter
Serial I/O
Parallel Slave Port
All components connected by common communication
lines called the system bus.
Microcontroller basics
Block diagram of a microcontroller system
MCU Architecture
RISC (Harvard)
Reduced instruction set computer
Simple operations
Simple addressing modes
Longer compiled program bust faster to execute
Uses pipelining
CISC (Von Neuman)
Complex instruction set computer
More complex instructions (closer to high-level
language support)
Types of microcontrollers
Main 8-bit Controllers
Microchip
RISC architecture (reduced instruction set computer)
Has sold over 2 billion as of 2002
Cost effective and rich in peripherals
Motorola
CISC architecture
Has hundreds of instructions
Examples: 68HC05, 68HC08, 68HC11
Intel
CISC architecture
Has hundreds of instructions
Examples: 8051, 8052
Many difference manufacturers: Philips, Dallas/MAXIM Semiconductor, etc.
Atmel
RISC architecture (reduced instruction set computer) –
Cost effective and rich in peripherals
AVR
A semiconductor
Memory storage device
consisting of registers
that store binary bits
Two major categories
Read/Write Memory
(R/WM)
Read-only-Memory
(ROM)
Symbolic Representation of Memory
Contents
Addresses Registers
What is the address bus value?
CODE: PORT A = 8000H
READ PORT A PORT B = 8001H
WRITE PORT B
STOP
Fetch / Decode /
Execute
Software: High-level Language
Assembly Language
From Machine to High-Level Machine Language
Languages (1 of 3)
Machine Language: binary instructions
Allprograms are converted into the machine
language of a processor for execution
Difficult
to decipher and write
Prone to cause many errors in writing
High-level Language
Assembly Language
Software: From Machine Machine Language
to High-Level Languages (2 of 3)
Assembly Language: machine instructions
represented in mnemonics
Has one-to-one correspondence with machine
instructions
Efficient in execution and use of memory;
machine-specific and not easy to troubleshoot
High-level Language
Software: From Machine Assembly Language
Machine Language
to High-Level Languages (3 of 3)
High-Level Languages (such as BASIC, C,
and C++)
Writtenin statements of spoken languages
(such as English)
machine independent
easy to write and troubleshoot
requires large memory and less efficient in
execution
Design Examples …..
Microcontrollers vs. Microprocessors
MPU-Based Time
and Temperature System
MCU-Based Time
and Temperature System
Microprocessor and microcontroller
Microprocessors Microcontrollers
Used for high performance Yes No
applications
Require external memory and Yes No
hardware
Used in desktop and laptop Yes NO
computers
Memory and IO on chip NO YES
Application specialized less NO YES
flexible
Architecture Von Neumann Harvard