Microprocessor LEB 40503: By: Mrs Shareen Adlina Binti Shamsuddin

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 56

MICROPROCESSOR

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.

“An electronic circuit on a single chip, which


performs arithmetic, logic and control operations
with the assistance of internal memory”.
6
EVERYDAY ITEMS THAT USE
MICROPROCESSORS

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.

 Microcomputer system – support µP operations.

8
MICROPROCESSOR
 The microprocessor can be used to perform complex
operations by giving it instructions.
 These instructions are called programs.

 Programs are loaded into memory, and are executed line-


by line by the microprocessor.

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

Figure 1: Standard block diagram of a microprocessor-based system


12
MICROPROCESSOR BASED-SYSTEM
• CPU (Central Processing Unit)  Control Unit
▫ The master controller of all operations
 Controls all the operations in a CPU
and basically it responsible to
▫ The main function are: retrieve instructions, analyze, then
 Data transfer execute.
 Arithmetic and logic operations ▫ The register array
 Decision making (instructional flow  Consists of at least one accumulator,
control) program counter and stack pointer
▫ Logic circuitry for communicating  to store data and addresses temporarily
with the system bus: data/address bus during execution of program
driver, bus controller
▫ Consist with ALU & Control Unit
 ALU (Arithmetic Logic Unit)
 The section of the CPU that
performs calculation for arithmetic
and logical operations
 Instruction decoder
 Control line
 counter

Figure 2: CPU in single chip 13


(Microprocessor)
MICROPROCESSOR – SYSTEM BUSES
• Communication path between the microprocessor, memory & peripherals.
• A group of wire to carry bits
• All peripherals share the same bus, the microprocessor communicates with
only one peripheral at one time.

•Carries the address of a unique memory or input/output (I/O)


device

•Carries data stored in memory (or an I/O device) to the CPU or


from the CPU to the memory (or I/O device)

•Is a collection of control signals that coordinate and synchronize


the whole system 14
MEMORY
 Stores instructions and data for CPU.
 Each memory location given unique address.
 CPU refers to address to access.
 Types:
 Read-Only Memory (ROM).
 Random-Access Memory (RAM).
 Non-Volatile Memory (NVM).

15
RAM, ROM AND NVM

ROM
Stores start-up
instructions and critical
system data and
variables.

Memory NVM

Stores general data


RAM and applications

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.

 EEPROM (Electrically EPROM): Electrical current.

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.

 Loses data without electrical power (volatile).

 Advantages:
 Programs can be loaded and reloaded.
 Larger capacity.
 Disadvantages:
 Requires power, refresh cycles.

20
RAM VS. ROM

RAM is still empty


because the computer
has just been started.
Computer is CPU looks for
turned on instructions from
memory

CPU loads
instructions
from ROM.
21
RAM VS. ROM

RAM loads more


advanced functions, such
ROM only has basic as the OS. 22
functions to start the computer.
TIMING CIRCUIT
Symbol Sample
 Synchronizes all components in the
system.
 All components refer to the clock
timing for operations.
 Generates square waves at constant
intervals.
 Crystal oscillator + timing circuitry. Equivalent Circuit
 Higher clock speed allow computers to
Crystal Oscillator
function faster.

T T T 23

Clock Signal
CLOCK SIGNAL VS. PROCESSING SPEED
 Instruction CLR.W D7 takes 4 cycles to complete.

Slow clock speed

24
time
Fast clock speed
I/O
 Input/Output.
 Connects µP with external devices:

 Add functionality to µP.


 Interfaces with µP using ports.

 Examples:
 Keyboard.
 Mouse.
 Display monitor.

25
HOW DO PORTS CONNECT TO SYSTEM
BUS?

Built into board

Using card slots.

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:

 Faster than serial.


 Simpler circuits – doesn’t need UART.
 Disadvantages:

 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

1. CPU is performing 2. Device has more


tasks normally. important task that requires
immediate attention.

4. CPU saves its current task 3. Device requests interrupt from


so that it can return to it CPU.
when the interrupt completes.

5. CPU services the interrupt.

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

1. CPU is performing 1. Watchdog monitors bus for errors.


tasks normally.

3. CPU saves its current task 2. If error detected, inform CPU.


so that it can return to it
when error is resolved.

4. CPU fixes the error.

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

Data Bus $1004 Empty


Data Registers
$1005 Empty
Data #1 Result #1
$1006 Empty
Result #1
$1007 Data #1
$1008 Data #2
If instruction wants to $1009 Data #3
Program Counter
write data to memory,
$1002
CPU puts its data and
address on the bus.
EXECUTE – 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 Result #1
Data #1
$1006 Empty
Result #1
$1007 Data #1
Memory receives
instructions and puts $1008 Data #2

data in the location. $1009 Data #3


Program Counter

$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

You might also like