You are on page 1of 89

ENT288 Microprocessor

Number of unit: 3
Lecture: 33 Hours (64%)
Laboratory: 10 Hours (20%)
Tutorial: 4 Hours (8%)
Mini project: 4 Hours (8)
Reference Book:
•Muhammad Ali Mazidi, Rolin D. Mckinlay &
Danny Causey.
•PIC Microcontroller and Embedded Systems:
Using Assembly and C for PIC18, Pearson
Prentice Hall 2008.
1.0 Introduction to Microprocessor
1.1 History of Computer
1.2 Components of a Computer
1.3 History of Microprocessor
1.4 Microprocessor System
1.5 Microcontroller System
1.6 Embedded System
1.7 Embedded System Application

2
1.1 History Of Computer

Abacus • 3000 BCE, early form


of beads on wires,
used in China
• From semitic abaq,
meaning dust.
Chinese Swan Pan
The Middle Ages
Charles Babbage (1791-1871)

• Born: December 26, 1791


• son of Benjamin Babbage a London banker
(part of the emerging middle class: property,
education, wealth, and status)
• Trinity College, Cambridge [MA, 1817]
with John Herschel and George Peacock, produced a
translation of LaCroix’s calculus text.
Ada Augusta Byron,
Countess of Lovelace
• Translated Menebrea’s paper into English
• Taylor’s: “The editorial notes are by the translator,
the Countess of Lovelace.”
• Footnotes enhance the text and provide examples
of how the Analytical Engine could be used, i.e.,
how it would be programmed to solve problems!
• Myth: “world’s first programmer”
Herman Hollerith and the Evolution of
Electronic Accounting Machines
• Born: February 29, 1860
– Civil War: 1861-1865
• Columbia School of Mines (New York)
• 1879 hired at Census Office
• 1882 MIT faculty (T is for technology!)
• 1883 St. Louis (inventor)
• 1884 Patent Office (Wash, DC)
• 1885 “Expert and Solicitor of Patents”
• Thomas J. Watson
(1874-1956)
hired as first president

• In1924, Watson renames


CTR as International
Business Machines
Electronic Numerical Integrator
and Computer (ENIAC)

• 1st large scale electronic digital computer


• designed and constructed at the Moore School
of Electrical Engineering of the University of
Pennsylvania
– since 1920s, faculty had worked with Aberdeen
Proving Ground’s Ballistics Research Laboratory
(BRL)
Early Thoughts about
Stored Program Computing
• January 1944 Moore School team thinks of better ways to
do things; leverages delay line memories from War
research
• September 1944 John von Neumann visits
– Goldstine’s meeting at Aberdeen Train Station
• October 1944 Army extends the ENIAC contract to include
research on the EDVAC and the stored-program concept
• Spring 1945 ENIAC working well
• June 1945 First Draft of a Report on the EDVAC: Electronic
Discrete Variable Automatic Computer
First Draft Report (June 1945)
• John von Neumann prepares (?) a report on the EDVAC
which identifies how the machine could be programmed
(unfinished very rough draft)
– academic: publish for the good of science
– engineers: patents, patents, patents
• von Neumann never repudiates the myth that he wrote it;
most members of the ENIAC team ontribute ideas
EDSAC

• Maurice Wilkes, University Mathematical


Laboratory, Cambridge University
• Moore School Lectures
• Electronic Delay Storage Automatic Calculator,
EDSAC operational May, 1949
• J. Lyons Company and the LEO, Lyons Electronic
Office, operational fall 1951
National Physical Laboratory
• Alan Turing
• Automatic Computing Engine (ACE)
• Basic design by spring, 1946
• Harry Huskey joins project
• Pilot ACE working, May 10, 1950
• English Electric: DEUCE, 1954
• Full version of ACE at NPL, 1959
Second Generation (1958-1964)
• 1958 Philco introduces TRANSAC S-2000
– first transistorized commercial machine
• IBM 7070, 7074 (1960), 7072(1961)
• 1959 IBM 7090, 7040 (1961), 7094 (1962)
• 1959 IBM 1401, 1410 (1960), 1440 (1962)
• FORTRAN, ALGOL, and COBOL are first standardized
programming languages
Third Generation (1964-1971)

• April 1964 IBM announces the System/360


– solid logic technology (integrated circuits)
– family of “compatible” computers
• 1964 Control Data delivers the CDC 6600
• nanoseconds
• telecommunications
• BASIC, Beginners All-purpose Symbolic Instruction Code
Fourth Generation (1971- )

• Large scale integrated circuits (MSI, LSI)


• Nanoseconds and picoseconds
• Databases (large)
• Structured languages (Pascal)
• Structured techniques
• Business packages
PDP-11 (1970)
Intel
• Noyce, Moore, and Andrew Grove leave Fairchild and
found Intel in 1968
– focus on random access memory (RAM) chips
• Question: if you can put transistors, capacitors, etc. on
a chip, why couldn’t you put a central processor on a
chip?
• Ted Hoff designs the Intel 4004, the first
microprocessor in 1969
– based on Digital’s PDP-8
Microcomputers
• Ed Roberts founds Micro Instrumentation
Telemetry Systems (MITS) in 1968
• Popular Electronics puts the MITS Altair on the
cover in January 1975 [Intel 8080]
• Les Solomon’s 12 year old daughter, Lauren, was a
lover of Star Trek. He asked her what the name of
the computer on the Enterprise was. She said “
‘computer’ but why don’t you call it Altair because
that is where they are going tonight!”
21
1.2 Components of a Computer
Computer Architectures
• Princeton versus Harvard Architecture
• CISC versus RISC processors
• Microprocessors and Microcontrollers

22
von-Neumann Architecture

The CPU can


either read an
instruction or
read/write data
from/to the
memory. Both
cannot occur at the
same time

23
Harvard Architecture

CPU can read an instruction and perform a data memory


access at the same time 24
25
RISC vs. CISC
RISC: Reduced Instruction Set computers
RISC features:
– Every instruction does a simple task
– Fixed instruction length (usually 32 bits)
– Data operations only applies to registers not memory
– Use memory load and store instruction to move data
– Use general purpose registers (usually 32)
– Use simple ways of referencing memory words

CISC: Complex Instruction Set computers

26
Basic Computer Architecture
• Central Processing Unit
– Interprets and carries out all the instructions contained in
software
• Memory
– Used to store instructions and data
– Random Access Memory (RAM)
– Read Only Memory (ROM)
• Input/Output
– Used to communicate with the outside world
Buses

I/O CPU Memory

27
28
1.3 History Of Microprocessor
1950s - The beginning of the digital era and
electronic computing
1969 – Intel is a small startup company in Santa
Clara with 12 employees. Fairchild, Motorola
are large semiconductor companies; HP and
Busicom make calculators
1971 – Intel makes first microprocessor the 4-bit
4004 series for Busicom calculators
1972 – Intel makes the 8008 series, an 8-bit
microprocessor, ATARI is a startup company,
Creates a gaming console and releases PONG

29
1974 – the first real useful 8-bit microprocessor is
released by Intel – the 8080Motorola introduces
the 6800 series. Zilog has the Z80
1975 – GM and Ford begin to put microcontrollers
in cars. Many cars today have over 100
microcontrollers. TI gets into the microprocessor
business with calculators and digital watches
1977 – Apple II is released using MOS 6502
(similar to motorola 6800). Apple II dominated
from 1977 to 1983
1978 – Intel introduces the first 16-bit processor,
the 8086. Motorola follows with the 68000 which
is ultimately used in the first Apple Macintosh

30
1981 – IBM enters the PC making market and
uses the Intel 8088 – proliferation of the home
computer
1982-1985 – Intel introduces the 32-bit 80286
and 80386
1989 – 80486 is being used in PC’s, able to run
Microsoft Windows
1992 – Apple, IBM and Motorola begin to make
PowerMac and PowerPC’s using Motorola chips
1993 – Pentium chip is released
The rest is history

31
32
Microcontroller versus Microprocessor

33
34
Processor Performance

CPU Time
= # Cycles × Cycle Time
= # Instructions × CPI × Cycle Time

CPI: Cycles per instruction

35
Microprocessor
• A single chip that contains a whole CPU
– Has the ability to fetch and execute instructions
stored in memory
– Has the ability to access external memory,
external I/O and other peripherals
• Examples:
– Intel P4 or AMD Athlon in desktops/notebooks
– ARM processor in Apple iPod

36
Microprocessor (MPU)
– Read instructions
– Process binary data

CPU Time
= # Cycles × Cycle Time
= # Instructions × CPI ×
Cycle Time

CPI: Cycles per instruction


330_01 37
MCU-Based Systems
• Includes microprocessor, memory, I/O ports,
and support devices (such as timers) on a
single semiconductor chip
• Buses are generally not available to a system
designer
• I/O ports are generally multiplexed and can be
programmed to perform different functions

330_01 38
The CPU
• Purpose: The controlling element in a computer
system that performs data transfers, integer
arithmetic and logic, and input/output operations.
• Sizes: 4-bits to 64-bits
• Speeds: up to 4 GHz
• A byte is 8-bits
• Memory is addressed by byte
• RISC vs. CISC
39
CPU Task
• Executes instructions from the memory
system.
• A program is a collection of instructions stored
sequentially in the memory.
• A program is the computer’s software.
• The stored program concept makes the
computer fast and powerful.

40
Data Transfer Operations
• Most of a CPUs time is spent transferring data.
• Data transfers include: instruction fetches,
transfers between memory and registers,
transfers between registers and I/O.
• Transfers occur though the data bus.

41
Arithmetic and Logic Operations
• The CPU performs arithmetic on integers
using addition, subtraction, multiplication, and
division (some microcontrollers do not divide).
• Logic operations include AND, OR (inclusive and
exclusive), NOT, and shift/rotate.

42
Decisions
• The CPU makes decisions based upon numeric
facts to control the flow of a program.
• Zero—Not Zero, Positive—Negative, Carry—
No Carry
• Decisions modify the flow of a program
• Flow control allows tasks to be repeated or
skipped.

43
Memory
• Memory in a computer system is normally
numbered in bytes.
• Memory is accessed by bytes using a memory
address (address bus) numbered from memory
location 00000000.
• Memory addresses are expressed in the
hexadecimal numbering system (radix 16).
• Memory data flow through the data bus.

44
Data Bus
• The data bus is 4-, 8-, 16-, 32-, or 64-bits in
width in modern computers.
• The size of the CPU and its data bus are the
same or in some cases the data bus may be
twice as wide as the CPU size.
• A 16-bit computer has a 16-bit data bus.
• The Pentium 4 is a 32-bit computer with a 64-
bit data bus.

45
Address Bus
• The address bus selects a memory location or an I/O
device
• The size (number of bits) of the address bus
determines the maximum memory size.
• An 8-bit address can address 256 bytes of memory
(28).
• 1K = 1024 and requires a 10-bit address
• 1M = 1024 * 1024 and requires a 20-bit address
• 1G = 1M * 1024 and requires a 30-bit address
• 1T = 1G * 1024 and requires a 40-bit address
46
Control Bus
• The control bus controls memory and I/O.
• The control bus contains two main signals that
originate from the CPU.
• The #RD signal causes a read operation.
• The #WR signal causes a write operation.
• Some CPUs also contain a signal that selects
memory or I/O called M/#IO.

47
ROM
• A ROM is a nonvolatile memory that is used to
store programs and static data
• The ROM is usually either an EPROM or an
EEPROM memory.
• The EPROM is erased using an ultraviolet
lamp.
• The EEPROM is erased electrically
• In either device, memory does not change
when power is removed from the system.
48
RAM
• The RAM is the read/write memory in a system that
stored dynamic data and will not retain data without
power.
• RAM is available as either SRAM or DRAM.
• SRAM stores data as long as power is applied.
• DRAM must be refreshed because it only stores data
for a few milliseconds.
• Large memory system usually use DRAM and small
memory systems usually use SRAM.

49
I/O
• The I/O in a computer allows the CPU and its
program to communicate to humans and
machines.
• A input device inputs data to the CPU and
examples include keyboards and switches.
• An output device accepts data from the CPU
and examples include printers, indicators, and
so forth.
• I/O data is often 8-bits in width.
50
INSTRUCTION SET

RISC (Reduced Instruction Set Computer)


i.e. PIC Microcontroller

CISC (Complex Instruction Set Computer)


i.e. Intel 8085

51
Intel processors
• CPU Year Data Memory MIPS
• 4004 1971 4 1K
• 8008 1972 8 16K
• 8080 1974 8 64K
• 8088 1980 8 1M .33
• 80286 1982 16 1M 3
• 80386 1985 32 4G 11
• 80486 1989 32 4G 41
• Pentium1993 64 4G 111
53
Microcontroller
• Essentially a microprocessor with on-chip memories
and I/O devices
• Designed for specific functions
• All in one solution - Reduction in chip count
– Reduced cost, power, physical size, etc.
• Examples
– MC68332, MC68HC11, PPC555
• More details of components later
– A/D converters, temperature sensors, communications,
timing circuits, many others

54
Microcontroller Components – CPU
• Smart part
– Processes instructions
and data
– All the parts of a
microprocessor Register 0
address data
• Registers – fast memory Register 1
r/w Register n-1
used to store operands and
other information inst
ALU
– Condition register –
positive/negative result
– Exception register – CPU
overflow condition
– Loop count register
• Load-store architecture 55
•CPU
•On-chip peripherals and
memory
•Parallel and serial digital I/O
•Analog I/O
•Counters and timers
•Internal ROM and/or EPROM

Support Devices
Timers
A/D converter
Serial I/O
Common communication lines
System Bus
56
Microcontroller Components – Memory
• Each memory location has
a specific address
• We must supply an Memory location 0
Memory location 1
address to access the
corresponding location
address data
• R/W allows us to select
reading or writing Memory location n-2
• Various types of memory Memory location n-1
for different functions and
r/w
speeds

57
Microcontroller Components – Memory
• Read Only Memory - Memory that can only be read
– Holds the program code for a microprocessor
used in an embedded system where the code is
always the same and is executed every time the
system is switched on
– Computer BIOS, boot-up information
• Other types of Read Only Memory
– Erasable Programmable Read Only Memory
(EPROM) – Similar to ROM but can be erased
(exposure to ultraviolet light) and reprogrammed
– Electrically Erasable Programmable Read Only
Memory (EEPROM) – more common that EPROM
because it can be erased by the microprocessor
– Flash Memory, Ferroelectric RAM (FRAM),
Magnetic Random Access Memory (MRAM) 58
Microcontroller Components – Memory
• Random Access Memory – used to store dynamic data when processor
is running
– Holds program code and data during execution
– Can be accesses in any random order – unlike takes or disks
• Some types of RAM
– Static RAM (SRAM) – Uses transistors to store bits, fast SRAM is used
for cache
– Dynamic RAM (DRAM) – Uses capacitors to store bits, must be
refreshed, smaller and cheaper than SRAM
• Fast Page Mode (FPM), Extended Data Out (EDO)
• Synchrounous DRAM (SDRAM) – introduced in 1997 and replaced
most DRAM in computers by 2000
• Double Data Rate (DDR SDRAM) – uses both clock edges found
today in most computers
• Direct Rambus DRAM (RDRAM) – somewhat of a flop

59
Microcontroller Components – I/O
• Connection to the outside world
• Examples
– Analog to Digital Converter
– Temperature Sensor
– Display
– Communications Circuit

60
Microcontroller Components – BUS
• Group of wires used to transport information
• CPU to Memory
– Address bus
– Data bus
• CPU to I/O
– Port mapped I/O – used when address space is
limited, special instructions are needed for I/O
– Memory mapped I/O – I/O looks like memory
locations, easier to use and common in Reduced
Instruction Set Computing (RISC)

61
Microcontroller unit sales are 15x higher than
microprocessors. and cheaper but less feature and
processing power. Microcontrollers are a large market
with growth rate for 2003 is at 9.42%.

•16- and 32-bit and higher are on the rise. They will
double their unit market share from 15.11% in 1998 to
31.56% in 2003, decreasing 4-bit and 8-bit devices.
•The manufacturer Intel, AMD, PIC, ARMS, TI,
Motorola, Siemens, Hitachi, MIT, Renesas, Samsung.
•1994 Malaysia's first locally designed IC, 16-bit RISC
microprocessor, Pesona.
62
63
1.6 Embedded System
• Special purpose computer system usually completely inside the device it
controls
• Has specific requirements and performs pre-defined tasks
• primarily as a means to simplify the system design and to provide flexibility.
• Often the user of the device is not even aware that a computer is present.
• Cost reduction compared to general purpose processor
• Different design criteria
– Performance
– Cost
– Reliability
– Availability
– Safety

64
Types of Embedded System

65
Embedded controller is selected based on system
requirements;

•data bus width and processing speed


•memory for data collection and storage and control
program.
•built-in mathematic function, ADC, DAC, Servo
•input/output, communication and package size and
application.
•Low power, small size and light weight
•device development tools, testing and production cost.

66
What is a Real-Time System?
• Real-time systems process events.
• Events occurring on external inputs cause
other events to occur as outputs.
• Minimizing response time is usually a
primary objective, or otherwise the entire
system may fail to operate properly.

Hard/Soft Real-Time Systems


• Soft Real-Time System
– Compute output response as fast as possible,
but no specific deadlines that must be met.
• Hard Real-Time System
– Output response must be computed by specified
deadline or system fails. 67
Multi-Tasking and Concurrency
• Most real-time systems are also embedded
systems w/several inputs and outputs and
multiple events occurring independently.

• Separating tasks simplifies programming,


but requires somehow switching back and
forth among the three task (multi-tasking).

• Concurrency is the appearance of


simultaneous execution of multiple tasks.

68
Embedded System Programming
Low Level Language

• Machine Language
A bundle of binary bits with certain formats
Only asks for simple operations
AA
09
9F
• Assembly
High speed, low code size
However, difficult to do a large project in assembly
Assembly: textual notations of machine program
69
High level language e.g. C
– Ease of management of large embedded projects
– Provides an additional level above assembly programming
– Fairly efficient
– Supports access to I/O

70
71
72
1.7 Embedded System Application

73
74
75
76
77
78
79
80
81
82
83
84
85
86
M-NOSE Ver 1.0
• Microcontroller - Hitachi 8-bit H8/3687
• RAM - 4KB 32MHz and 512 KB flash memory
• ADC - 8 channe10 bits
M-NOSE Ver 2.0
• Microcontroller - Rabbit 8-bit RCM4000
• RAM - 512KB 58MHz and 32MB flash memory
• ADC - 8 channe12 bits
M-NOSE Ver 3.0

Microcontroller - Rabbit 8-bit RCM4000


RAM - 512KB 58MHz and 32MB flash memory
ADC - 8 channe12 bits

You might also like