Professional Documents
Culture Documents
Microprocessor LEB 40503: By: Mrs Shareen Adlina Binti Shamsuddin
Microprocessor LEB 40503: By: Mrs Shareen Adlina Binti Shamsuddin
Microprocessor LEB 40503: By: Mrs Shareen Adlina Binti Shamsuddin
LEB 40503
By:
Mrs Shareen Adlina Binti Shamsuddin
1
READING LIST:-
2
CHAPTER 1:
INTRODUCTION TO
MICROPROCESSOR
3
WHAT WE ARE GOING TO LEARN IN
THIS SESSION:
What is a microprocessor.
What is a microprocessor system.
Components inside the microprocessor system:
Component description.
Function.
Arrangement.
The CPU execution cycle.
What is it.
How the cycle works.
4
MICROPROCESSORS
5
MICROPROCESSOR
A microprocessor is an electronic device that consists of
millions (or billions) of transistors packed into one IC.
Its function is to execute instructions in the form of
programs, calculate and store its results.
Microprocessors are used widely in our everyday lives.
7
MICROPROCESSOR
µP is a complex, powerful device:
Able to process huge amounts of data.
Built using transistors etched on silicon die.
Needs external components to support operation.
8
MICROPROCESSOR
The microprocessor can be used to perform complex
operations by giving it instructions.
These instructions are called programs.
9
MICROPROCESSOR
SYSTEMS
MICROPROCESSOR SYSTEMS
Definition: A complete electronic system built around
the microprocessor to support the microprocessor
operation.
May consist of CPU, memory, I/O (disk drives,
keyboard, mouse), system bus, and supporting circuitry.
CPU as the “brain” – controls actions of all components.
11
MICROPROCESSOR BASED-SYSTEMS
15
RAM, ROM AND NVM
ROM
Stores start-up
instructions and critical
system data and
variables.
Memory NVM
16
ROM
Read-Only Memory:
Data can be read, but cannot be written (read-only).
Contents stay without power (non-volatile).
Usually contains basic start-up instructions, data.
Contents hard-wired during manufacturing.
Newer versions can be reprogrammed:
PROM (Programmable ROM): Fuse & anti-fuse.
EPROM (Erasable Programmable ROM): UV light.
17
ROM EXAMPLES
EEPROM Programmer
EPROM 18
Quartz Window
NVM
Non-Volatile Memory
Contents can be read and written.
Contents stay without power (non-volatile).
Advantages:
Keeps memory even with no power.
Data is protected against blackouts.
Rewriteable.
Disadvantages:
Slower than RAM.
19
RAM
Random Access Memory.
Contents can be read and written.
Advantages:
Programs can be loaded and reloaded.
Larger capacity.
Disadvantages:
Requires power, refresh cycles.
20
RAM VS. ROM
CPU loads
instructions
from ROM.
21
RAM VS. ROM
T T T 23
Clock Signal
CLOCK SIGNAL VS. PROCESSING SPEED
Instruction CLR.W D7 takes 4 cycles to complete.
24
time
Fast clock speed
I/O
Input/Output.
Connects µP with external devices:
Examples:
Keyboard.
Mouse.
Display monitor.
25
HOW DO PORTS CONNECT TO SYSTEM
BUS?
26
SERIAL I/O
Sends/receives data sequentially across 2 channels.
One for receive, one for transmit.
Connects using serial ports.
Advantages:
Less crosstalk.
Disadvantages:
Slow.
Needs special circuit to convert back to parallel (UART –
Universal Asynchronous Receiver/Transmitter).
27
SERIAL PORT
28
PARALLEL I/O
Sends/receives data across multiple lines at one time.
Connects using parallel ports.
Advantages:
Crosstalk.
29
PARALLEL PORT
30
PARALLEL VS. SERIAL I/O
1011011010101010011010101010100011101100101 Receive
1011011010101010011010101010100011101100101 Transmit
Serial Port
1011011010101010011010101010100011101100101 Receive/Transmit
1011011010101010011010101010100011101100101 Receive/Transmit
1011011010101010011010101010100011101100101 Receive/Transmit
.
. 31
Parallel Port
UART
1
From Device 1001 0 To System Bus
UART
0
1
1
To Device 1001 0 From System Bus
UART
0
1
32
INTERRUPT CIRCUIT
Allows other components to “interrupt” normal CPU
operation:
Prioritize CPU tasks.
Error detection mechanism.
Accept inputs from devices – keystroke, mouse press.
Depends on task importance:
Important tasks given higher interrupts.
Less important tasks queued.
CPU keeps track of current interrupt level.
33
HOW INTERRUPTS WORK
CPU Device
34
6. CPU reloads saved task,
and resumes normally.
WATCHDOG MONITOR
Watchdog monitor:
Special circuit - monitors the system for errors.
Informs the CPU.
CPU takes appropriate actions – re-execute instruction, reset
system, halt processor.
May work in two ways:
Constantly monitor the system, and sends signal if error
detected.
Continuously sending signal to CPU after certain interval:
If CPU receives signal, continues processing.
If CPU doesn’t receive signal, something’s wrong.
35
HOW WATCHDOGS WORK
CPU Watchdog
36
5. CPU reloads saved task, 5. If error is too serious, CPU may reset/halt system.
and resumes normally.
CPU EXECUTION
CYCLE
CPU EXECUTION CYCLE
CPU executes instructions in endless fetch,
decode, execute cycles.
It only knows how to do three things:
Fetchinstructions from somewhere.
Analyze instruction, get more data if necessary.
Execute instruction.
Keeps track of instruction using Program
Counter (PC):
Tells CPU location of next instruction.
FETCH, DECODE, EXECUTE
FETCH – STEP 1
CPU Memory
$1000 Instruction #1
Control
$1001 Instruction #1
$1002 Instruction #2
Instruction Register
$1003 Instruction #2
$1004 Empty
Data Registers
$1005 Empty
CPU gets instruction $1006 Empty
address from PC $1007 Data #1
$1008 Data #2
$1009 Data #3
Program Counter
$1000
FETCH – STEP 2
CPU Memory
Address Bus
$1000 Instruction #1
Control $1000 $1001 Instruction #1
$1002 Instruction #2
Instruction Register
$1003 Instruction #2
$1004 Empty
Data Registers
$1005 Empty
CPU outputs $1006 Empty
instruction address $1007 Data #1
through Address Bus $1008 Data #2
$1009 Data #3
Program Counter
$1000
FETCH – STEP 3
CPU Memory
Data Bus
$1000 Instruction #1
Control Instruction #1 $1001 Instruction #1
$1002 Instruction #2
Instruction Register
$1003 Instruction #2
$1004 Empty
Data Registers
$1005 Empty
Memory gets the $1006 Empty
instruction and $1007 Data #1
sends in to CPU $1008 Data #2
using Data Bus. $1009 Data #3
Program Counter
$1000
FETCH – STEP 4
CPU Memory
$1000 Instruction #1
Control
$1001 Instruction #1
$1002 Instruction #2
Instruction Register
Instruction #1 $1003 Instruction #2
$1004 Empty
Data Registers
$1005 Empty
CPU stores instruction $1006 Empty
in Instruction Register $1007 Data #1
$1008 Data #2
$1009 Data #3
Program Counter
$1000
FETCH – STEP 5
CPU Memory
$1000 Instruction #1
Control
$1001 Instruction #1
$1002 Instruction #2
Instruction Register
Instruction #1 $1003 Instruction #2
$1004 Empty
Data Registers
$1005 Empty
After instruction has $1006 Empty
been loaded, CPU $1007 Data #1
updates Program $1008 Data #2
Counter. $1009 Data #3
Program Counter
$1002
DECODE – STEP 1
CPU Memory
$1000 Instruction #1
Control
$1001 Instruction #1
$1002 Instruction #2
Instruction Register
Instruction #1 $1003 Instruction #2
$1004 Empty
Data Registers
$1005 Empty
CPU analyzes $1006 Empty
instructions before $1007 Data #1
executing it. $1008 Data #2
$1009 Data #3
Program Counter
$1002
Type of instruction.
Does the instruction require any data to perform calculations?
Where are the data located?
EXECUTE – STEP 1
CPU Memory
Address Bus
$1000 Instruction #1
Control $1007 $1001 Instruction #1
$1002 Instruction #2
Instruction Register
Instruction #1 $1003 Instruction #2
$1004 Empty
Data Registers
$1005 Empty
If instruction requires $1006 Empty
data from memory, $1007 Data #1
data address is $1008 Data #2
placed on address $1009 Data #3
Program Counter
bus.
$1002
EXECUTE – STEP 2
CPU Memory
Data Bus
$1000 Instruction #1
Control Data #1 $1001 Instruction #1
$1002 Instruction #2
Instruction Register
Instruction #1 $1003 Instruction #2
$1004 Empty
Data Registers
$1005 Empty
Memory gets the $1006 Empty
instruction and $1007 Data #1
sends in to CPU $1008 Data #2
using Data Bus. $1009 Data #3
Program Counter
$1002
EXECUTE – STEP 3
CPU Memory
$1000 Instruction #1
Control
$1001 Instruction #1
$1002 Instruction #2
Instruction Register
Instruction #1 $1003 Instruction #2
$1004 Empty
Data Registers
$1005 Empty
Data #1
CPU puts data inside $1006 Empty
internal data registers $1007 Data #1
and execute $1008 Data #2
instructions. $1009 Data #3
Program Counter
$1002
EXECUTE – STEP 4
CPU Memory
Address Bus
$1000 Instruction #1
Control $1005 $1001 Instruction #1
$1002 Instruction #2
Instruction Register
Instruction #1 $1003 Instruction #2
$1000 Instruction #1
Control
$1001 Instruction #1
$1002 Instruction #2
Instruction Register
Instruction #1 $1003 Instruction #2
$1004 Empty
Data Registers
$1005 Result #1
Data #1
$1006 Empty
Result #1
$1007 Data #1
Memory receives
instructions and puts $1008 Data #2
$1002
CONCLUSION
CONCLUSION
µP is a complex, powerful device:
Able to process huge amounts of data.
µP-based systems provide supporting circuitry to
support µP functions.
Long history, advancements along with
technology.
Executes instructions from memory in endless
loop.
IMPORTANT MICROPROCESSOR YOU
SHOULD KNOW
53
EMBEDDED SYSTEMS
• Simple definition: Computing systems embedded
within electronic devices
• Nearly any computing system other than a desktop
computer
• Designed to perform a specific function
• Take advantage of application characteristics to
optimize the design
• You BUY (not design) a general purpose computer.
54
GENERAL PURPOSE COMPUTING VS.
EMBEDDED SYSTEM
55
OTHER PROCESSOR IN EMBEDDED
SYSTEMS
• Embedded controllers:
▫ More powerful (32 bits) than microcontrollers (8 bits)
▫ Normally contains only processor and input/output, memory is
external
• Digital signal processors:
▫ Embedded processors optimized for digital signal processing
▫ Commonly found in hand phones, modems, communications
systems
• Graphics processors:
▫ Very powerful processors found in graphics cards of workstations
• Programmable Logic Controllers:
▫ Microprocessor boards usually found in industrial applications
56