SlideShare a Scribd company logo
Microprocessor Basics
05/09/15 Presentation By Sania Gul 2
Microprocessor & Microcomputer
• The complete processor built on a single
chip is called microprocessor (µP) or
micro processing unit (MPU).
• The computer built from microprocessor is
called microcomputer
05/09/15 Presentation By Sania Gul 3
Architecture of Microcomputer
Bus Architecture
05/09/15 Presentation By Sania Gul 4
MEMORY (Primary & Secondary)
• Primary storage memory is made of RAM & ROM.
• Secondary storage memory is Hard disk, Floppy disk,
USB, CDs, DVDs etc. These devices store data so they
are memory devices but for the microprocessor all
secondary memory devices are I/O devices. For µP,
memory is only the primary memory.
05/09/15 Presentation By Sania Gul 5
Peripherals
• All I/O devices are called peripherals.
• The µP, primary memory & the peripherals
are connected to system bus and all the
data exchange among them takes place
over the system bus.
05/09/15 Presentation By Sania Gul 6
Primary Memory
• The primary memory is a collection of lot of
registers. One register of memory can hold any
number of bits, but usually it is designed to hold
1 byte (8 bits).
• The complete chip consists of lot of such
register, each having different address by which
µP calls it (or identifies it).
• Remember, the number of registers in a memory
chip are always in the power of 2. For example u
have heard about kilo byte (KB), Mega Byte
(MB), Giga Byte (GB) etc.
05/09/15 Presentation By Sania Gul 7
Primary Memory always in power of
2
1 KB 210
Bytes =1024 Bytes
1 MB 220
Bytes =1024 K Bytes
1GB 230
Bytes =1024 Mbytes
1 TB 240
Bytes =1024 GBytes
05/09/15 Presentation By Sania Gul 8
I/O peripherals
• Well known I/O devices are printer, scanner, key
board, mouse, joy stick etc.
• The I/O devices are connected to system bus
through peripheral interface IC called I/O
controllers. (u can see these ICs on the mother
board).
• This IC or I/O controller consists of many
registers & like memory each register inside the
IC has a unique address & µP calls them by
their address to exchange data with them.
05/09/15 Presentation By Sania Gul 9
Peripheral controller
Hard disk,
floppy disk,
CD-R, DVD
Modem, LAN Card Monitor, LCD,
Multimedia
05/09/15 Presentation By Sania Gul 10
System bus
• Bus is a group of wires that transmit a
binary word. The system bus is
composed of 3 buses.
1. Address bus
2. Data Bus
3. Control Bus
05/09/15 Presentation By Sania Gul 11
System bus
1. Address bus:
The address bus is used to carry the address from
micro-processor to peripheral or memory. The
address generated by the µP is in the form of bits &
each bus line carries one bit of address. It is a
unidirectional bus.
Each line is represented by “A”
2. Data Bus:
The data from memory or peripheral to µP & vice
versa is exchanged on data bus. It is a bidirectional
bus.
Each line is represented by “D”
05/09/15 Presentation By Sania Gul 12
System Bus
3. Control bus:
This bus is used to carry control signals from µP to
memory or peripherals & vice versa. It is not a
bus in the true sense as it is not a common
transmission medium to carry control signal.
Every device is connected to microprocessor
control pins individually.
Multiplexed Bus: In order to reduce external pins, one pin can
be shared to carry both address & data. But both are not carried at
the same time. This kind of bus is called multiplexed bus,
Each line is represented by “AD”. (address data)
05/09/15 Presentation By Sania Gul 13
Address decoding of 4 bit address
This register is
selected with
address of 0 H
and its contents
are CD H
05/09/15 Presentation By Sania Gul 14
Memory with on chip address
decoding
05/09/15 Presentation By Sania Gul 15
Memory Interfacing
05/09/15 Presentation By Sania Gul 16
Address space
• The complete set of addresses which can
be created from fix number of bits. e.g.
with 4 bits only 24
(16) address can be
created. The address range will be
– 0000 = 0H (first address) note: addresses are always given in Hex format
– 0001 =1H (Second address)
– 1111 = FH (last address)
05/09/15 Presentation By Sania Gul 17
Address mapping
• On maps of houses, we give particular
location of a room, washrooms & kitchen.
• Like wise allocating a unique address to
any register or device on the address
space is called address mapping.
Memory
address
space
05/09/15 Presentation By Sania Gul 18
Memory Matrix
05/09/15 Presentation By Sania Gul 19
Inside Microprocessor
• There are also registers inside the µP. Some special
purpose registers & few data registers. The purpose of
data registers is to store data & results. These results
can afterwards be displayed on output devices or stored
in memory for later use.
• As there are very few registers inside processor so
instead of address, they got names like register A, B, C
etc.
• The size of processor register defines how much
maximum data, the processor can process at one time.
For example the size of 8085 µP’s registers is 8 bit, so it
is 8 bit processor & that of 8088/8086 is 16 bits, so it is
16 bit processor.
05/09/15 Presentation By Sania Gul 20
Inside Microprocessor
05/09/15 Presentation By Sania Gul 21
Performance Comparison of µPs
• Performance of microprocessor is
measured in units of MIPS how many
million of instructions they can execute per
second.
05/09/15 Presentation By Sania Gul 22
Primary memory Segmentation
• Imagine u visit a library & there are no sections. All
books are randomly placed. Can u find your required
book easily? NO
• Similarly the program (code) & data must be organized
in different sections of memory to help the processor to
find them easily, because it will reduce the processing
time.
05/09/15 Presentation By Sania Gul 23
Types of Segments
4 types of segments exists in memory
1. Code Segment  for storing program
2. Data Segment  for storing Data
3. Stack Segment for storing Temporary Data
4. Extra Segment  for storing extra Data in addition to
data in DS
05/09/15 Presentation By Sania Gul 24
Code Segment (CS)
• It is that portion of memory which contains
the program (Code).
• The program is set of instructions. The µP
fetches (picks) one instruction from the
memory, decodes it to find what to do, &
process the data according to the
instruction.
• So for each instruction 3 steps are performed
• Fetch  Decode  Execute
05/09/15 Presentation By Sania Gul 25
Program Counter (PC) or
Instruction pointer (IP)
• Pointer means address. IP is a register inside
microprocessor which holds the address of next
instruction to be executed.
• When the processor fetches one instruction
from the memory, it automatically points to the
next instruction in the memory which is to be
executed after the current instruction.
• It is like an office secretary who always points to
his officer what to do next in his schedule. Its job
is to send to the memory the address of the next
instruction to be fetched & executed.
05/09/15 Presentation By Sania Gul 26
Stored program
• The instructions are already stored by
programmer in the memory. When the
processor is turned on, it automatically
takes first instruction from the memory
because initially its IP or PC is 0H.
• The instructions are stored in binary
format in memory & one instruction may
take one byte or many bytes of memory.
05/09/15 Presentation By Sania Gul 27
Sequential execution
• Computer is a sequential machine i.e. it fetches
instructions from memory and executes them in proper
order. unless there is any instruction or external event
(interrupt) which breaks the sequence.
Main Program
1st
instruction
2nd
instruction
3rd
instruction
4th
instruction
last instruction
CPU
memory
Data bus
Main Program
1st
instruction
2nd
instruction
3rd
instruction
4th
instruction
last instruction
05/09/15 Presentation By Sania Gul 28
Instruction Cycle
Instruction
decoder &
control unit
Adder Inverter AND
logic
PC
A
B
C
0H
Add
res
s
Contents
0H 80 H
1H 12 H
2H 40 H
3H 05 H
4H 75 H
AH 06 H
BH 01H
MOV A,3H
ADD A, 5H
HLT
80 H12H
2H
3H
ADD A,5H
4H
Sum=8H
Memory
=16
Bytes
Data
Segment
Code
Segment
4 bit Address
Bus
8 bit data bus
RD control signal
Note: if the instruction is of 2 bytes, it takes 2 Bus
cycles to Fetch the instruction if the data Bus is 8
bit wide.
05/09/15 Presentation By Sania Gul 29
Instruction Cycle
• Cycle means duration. The µP takes certain
amount of time to execute the instruction. The
time required varies from one processor to other
& also depends on System Clock frequency f.
• For example, the instruction ADD A, 5H takes 4
T states.
• If the system clock frequency f=2 Hz, the
• T=1/f = ½ =0.5 s
• So ADD A, 5H  4 T = 4* 0.5= 2 s
05/09/15 Presentation By Sania Gul 30
Sub routines/ procedure or
functions
These are small programs written separately from the main
program. These program are written separately
because of many reasons like.
1. It makes programming modular, easy to debug, &
allowing many programmers to work on small units of
their interests.
2. The subroutine developed by one programmer can be
used by other programmers in their own programs.
3. The subroutine can be called by main program many
times without writing the sub routine code again &
again so less memory is required.
The program control is passed to subroutine when the main
program calls it, & returned back to main program
once the subroutine is finished.
05/09/15 Presentation By Sania Gul 31
Stack Segment (SS)
• It is the portion of the RAM used for temporary storage of Data.
• It is the data structure which works on LIFO (last in first out
principle) like a stack of books. The last data pushed on the stack is
the one which is popped first.
• In Intel µPs, the stack storage starts from the highest address &
continue towards the lower addresses.
• In normal data structures the data is stored starting from the lowest
address (the bottom) and continue towards the higher addresses
even in Intel micro controller’s stack.
Higher address
Lower address
Stack grows
05/09/15 Presentation By Sania Gul 32
Need of Stack Segment
• When the main program calls sub routine, the program control
shifts to sub routine & the Program counter PC is loaded with the
address of the first instruction of sub routine. However at the end
of subroutine, the control has to shifted back to the main program.
• So before shifting the control to sub routine, the contents of PC
are stored automatically on stack with the CALL instruction. And
when the sub routine is over, the old contents of PC are
automatically retrieved from the stack when the last instruction of
sub-routine RET is executed & execution starts from the next
instruction of the main program. which has called the sub-routine.
05/09/15 Presentation By Sania Gul 33
05/09/15 Presentation By Sania Gul 34
Need of Stack Segment
• As there are very few registers inside µP, so it may be
possible that the main program & sub-routine both
require them. This is not possible if there was no stack.
• So the programmer ensures that before the sub-routine
uses the µP registers, the data inside these registers
related to main program are stored on stack with the
help of PUSH instructions & then POPPED from the
stack at the end of sub-routine with the help of POP
instruction.
• The number of POPs instruction must be equal to
number of PUSHES.
• POPPING must be in reverse order of PUSHiNG to
restore original contents due to LIFO principle.
05/09/15 Presentation By Sania Gul 35
Pushing means adding
Popping means removing
05/09/15 Presentation By Sania Gul 36
Stack pointer
• This register stores the address of the Top
Of Stack (TOS), the top most valid filled
location of SS.
• As in Intel µPs, the stack grows from the
higher address towards the lower one, so
when the data is pushed on stack SP
decrements & when it is popped from
stack, SP increments.
05/09/15 Presentation By Sania Gul 37
05/09/15 Presentation By Sania Gul 38
05/09/15 Presentation By Sania Gul 39
05/09/15 Presentation By Sania Gul 40
Instruction pipelining
• In old processors, one instruction is fetched, decoded &
executed. After that the same process occurs for the
second instruction & so on.
• Fetching of the next instruction, while the current
instruction executes is called pipelining.
• This saves the time & increase processing speed.
05/09/15 Presentation By Sania Gul 41
BCD & Signed Numbers
Unpacked BCD
Packed BCD

More Related Content

What's hot (20)

PPT
B.sc cs-ii-u-2.2-overview of register transfer, micro operations and basic co...
Rai University
 
PPTX
Microprocessor Presentation
alaminmasum1
 
PDF
Chapter 2-8085 Microprocessor Architecture and Microcomputer Systems
cmkandemir
 
PDF
Overview of microcontroller and microprocessor
Mrunal Deshkar
 
PPTX
Microprocessor & Micro-controller
Om Bheda
 
PDF
Microprocessors & Microcomputers Lecture Notes
FellowBuddy.com
 
PPTX
Memory interfacing
mahalakshmimalini
 
PPTX
8085 full discription
Kartik Kalpande Patil
 
PPTX
Processor Basics
Education Front
 
DOC
Microprocessor Basics 8085 Ch-1
Neelam Kapoor
 
PPTX
Microprocessor
Paras Watts
 
PPTX
Microprocessor
Ashok Raj
 
PPTX
Computer organization
ishapadhy
 
PDF
Computer organiztion5
Umang Gupta
 
PPT
Introduction to microprocessor
Sudhir Reddy
 
PDF
Microprocessor Introduction
Naveen Dubey
 
PPTX
Design a processor
Farzana Aktar
 
PPTX
Introduction to 8085 microprocessor
kunj desai
 
PPT
Microprocessor application (Introduction)
Ismail Mukiibi
 
B.sc cs-ii-u-2.2-overview of register transfer, micro operations and basic co...
Rai University
 
Microprocessor Presentation
alaminmasum1
 
Chapter 2-8085 Microprocessor Architecture and Microcomputer Systems
cmkandemir
 
Overview of microcontroller and microprocessor
Mrunal Deshkar
 
Microprocessor & Micro-controller
Om Bheda
 
Microprocessors & Microcomputers Lecture Notes
FellowBuddy.com
 
Memory interfacing
mahalakshmimalini
 
8085 full discription
Kartik Kalpande Patil
 
Processor Basics
Education Front
 
Microprocessor Basics 8085 Ch-1
Neelam Kapoor
 
Microprocessor
Paras Watts
 
Microprocessor
Ashok Raj
 
Computer organization
ishapadhy
 
Computer organiztion5
Umang Gupta
 
Introduction to microprocessor
Sudhir Reddy
 
Microprocessor Introduction
Naveen Dubey
 
Design a processor
Farzana Aktar
 
Introduction to 8085 microprocessor
kunj desai
 
Microprocessor application (Introduction)
Ismail Mukiibi
 

Viewers also liked (18)

PPTX
Microprocessor:stack,shifting,looping
Samiul Ehsan
 
PPTX
Stack in microprocessor 8085(presantation)
Safin Biswas
 
PDF
Practicing oil analysis it's all about size
filtermag
 
PPT
Little book of leadership ppt
PINAKI ROY
 
PDF
Why you should quit smoking
Danial Sohail
 
PDF
Two to four wheeler transformable bike
Danial Sohail
 
PDF
Sae paper 881825
filtermag
 
PPS
Les metamorphose1
PINAKI ROY
 
PPS
BP risk factors
PINAKI ROY
 
PDF
Fm industrial data summary 2012
filtermag
 
PPT
boiler
Waqas Ahmed
 
PPS
Blood Pressure - The risk factors
PINAKI ROY
 
PPS
Numbers
PINAKI ROY
 
PDF
Survey of NED Auditorium Ground
Danial Sohail
 
PPT
hybrid vehicles
Waqas Ahmed
 
PPTX
Programming lab 1 lecture
iqbal ahmad
 
PDF
Nmlc ef3 module 1
John Roy Daulong
 
PPT
Tribology - The WDA Factor
PINAKI ROY
 
Microprocessor:stack,shifting,looping
Samiul Ehsan
 
Stack in microprocessor 8085(presantation)
Safin Biswas
 
Practicing oil analysis it's all about size
filtermag
 
Little book of leadership ppt
PINAKI ROY
 
Why you should quit smoking
Danial Sohail
 
Two to four wheeler transformable bike
Danial Sohail
 
Sae paper 881825
filtermag
 
Les metamorphose1
PINAKI ROY
 
BP risk factors
PINAKI ROY
 
Fm industrial data summary 2012
filtermag
 
boiler
Waqas Ahmed
 
Blood Pressure - The risk factors
PINAKI ROY
 
Numbers
PINAKI ROY
 
Survey of NED Auditorium Ground
Danial Sohail
 
hybrid vehicles
Waqas Ahmed
 
Programming lab 1 lecture
iqbal ahmad
 
Nmlc ef3 module 1
John Roy Daulong
 
Tribology - The WDA Factor
PINAKI ROY
 
Ad

Similar to microprocessor Lec 01 mic (20)

PPTX
Computer Arithmetic and Processor Basics
ShinuMMAEI
 
PPTX
ch 2_Component and function of computer .pptx
Toyba2
 
PPTX
Module -4_microprocessor (1).pptx
DrVaibhavMeshram
 
PDF
Ch2 embedded processors-i
Ankit Shah
 
PPTX
Microprocessor Fundamentals
Diwaker Pant
 
PPTX
Class 5 an 8 bit embedded platform
SURYAPRAKASH S
 
PPT
Microprocessor fundamentals
JLoknathDora
 
PDF
Embedded system book very helpful needed and use by everyone
ManojGupta666004
 
PDF
Introduction to 8085svv
Shivashekharayya Viraktamath
 
PDF
Introduction to Embedded Architecture
amrutachintawar239
 
PPT
1 introduction-to-computer
Rohit Shrivastava
 
PPTX
1 microcontroller 8051 detailed explanation
nachiketthakare101
 
PDF
VTU University Micro Controllers-06ES42 lecturer Notes
24x7house
 
PPTX
CS304PC:Computer Organization and Architecture Session 5 Basic Computer Orga...
Guru Nanak Technical Institutions
 
PPTX
0 lecture 3
umardanjumamaiwada
 
PPTX
lecture 3
umardanjumamaiwada
 
PPTX
introduction to Computer system
umardanjumamaiwada
 
PPT
Principle of Computer Operation.ppt
AbdulRehman703897
 
PDF
20838382 microprocessor-8085-notes
Ravali Sunki
 
PDF
E-Note_19681_Content_Document_20240512114009AM.pdf
gowdapriya678
 
Computer Arithmetic and Processor Basics
ShinuMMAEI
 
ch 2_Component and function of computer .pptx
Toyba2
 
Module -4_microprocessor (1).pptx
DrVaibhavMeshram
 
Ch2 embedded processors-i
Ankit Shah
 
Microprocessor Fundamentals
Diwaker Pant
 
Class 5 an 8 bit embedded platform
SURYAPRAKASH S
 
Microprocessor fundamentals
JLoknathDora
 
Embedded system book very helpful needed and use by everyone
ManojGupta666004
 
Introduction to 8085svv
Shivashekharayya Viraktamath
 
Introduction to Embedded Architecture
amrutachintawar239
 
1 introduction-to-computer
Rohit Shrivastava
 
1 microcontroller 8051 detailed explanation
nachiketthakare101
 
VTU University Micro Controllers-06ES42 lecturer Notes
24x7house
 
CS304PC:Computer Organization and Architecture Session 5 Basic Computer Orga...
Guru Nanak Technical Institutions
 
0 lecture 3
umardanjumamaiwada
 
lecture 3
umardanjumamaiwada
 
introduction to Computer system
umardanjumamaiwada
 
Principle of Computer Operation.ppt
AbdulRehman703897
 
20838382 microprocessor-8085-notes
Ravali Sunki
 
E-Note_19681_Content_Document_20240512114009AM.pdf
gowdapriya678
 
Ad

More from iqbal ahmad (11)

PDF
Probability, random variables and random signal principles 2nd ed. p. peebles
iqbal ahmad
 
DOCX
signal and system Lecture 3
iqbal ahmad
 
DOCX
signal and system Lecture 2
iqbal ahmad
 
PDF
signal and system Lecture 1
iqbal ahmad
 
DOC
signal and system Dirac delta functions (1)
iqbal ahmad
 
PDF
signal and system solution Quiz2
iqbal ahmad
 
PDF
Hw1 solution
iqbal ahmad
 
PDF
signal and system Hw2 solution
iqbal ahmad
 
PDF
Capacitors and inductors
iqbal ahmad
 
PDF
Second order ena notes
iqbal ahmad
 
PDF
First order ena notes
iqbal ahmad
 
Probability, random variables and random signal principles 2nd ed. p. peebles
iqbal ahmad
 
signal and system Lecture 3
iqbal ahmad
 
signal and system Lecture 2
iqbal ahmad
 
signal and system Lecture 1
iqbal ahmad
 
signal and system Dirac delta functions (1)
iqbal ahmad
 
signal and system solution Quiz2
iqbal ahmad
 
Hw1 solution
iqbal ahmad
 
signal and system Hw2 solution
iqbal ahmad
 
Capacitors and inductors
iqbal ahmad
 
Second order ena notes
iqbal ahmad
 
First order ena notes
iqbal ahmad
 

Recently uploaded (20)

PDF
A Brief Introduction About Robert Paul Hardee
Robert Paul Hardee
 
PPTX
Functions in Python Programming Language
BeulahS2
 
PPSX
OOPS Concepts in Python and Exception Handling
Dr. A. B. Shinde
 
PDF
Información de microsoft purview herramienta de microsoft
macarenabenitez6
 
PDF
13th International Conference of Security, Privacy and Trust Management (SPTM...
ijcisjournal
 
PDF
NFPA 10 - Estandar para extintores de incendios portatiles (ed.22 ENG).pdf
Oscar Orozco
 
PDF
William Stallings - Foundations of Modern Networking_ SDN, NFV, QoE, IoT, and...
lavanya896395
 
PPTX
darshai cross section and river section analysis
muk7971
 
PDF
Artificial Neural Network-Types,Perceptron,Problems
Sharmila Chidaravalli
 
PPTX
L300 Technical Slide Library_Feb 2025 microsoft purview
macarenabenitez6
 
PDF
Authentication Devices in Fog-mobile Edge Computing Environments through a Wi...
ijujournal
 
PPT
FINAL plumbing code for board exam passer
MattKristopherDiaz
 
PPT
Footbinding.pptmnmkjkjkknmnnjkkkkkkkkkkkkkk
mamadoundiaye42742
 
PDF
Digital water marking system project report
Kamal Acharya
 
PDF
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
PDF
Pictorial Guide To Checks On Tankers' IG system
Mahmoud Moghtaderi
 
PDF
this idjfk sgfdhgdhgdbhgbgrbdrwhrgbbhtgdt
WaleedAziz7
 
PPTX
Unit_I Functional Units, Instruction Sets.pptx
logaprakash9
 
PPTX
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
PDF
Module - 5 Machine Learning-22ISE62.pdf
Dr. Shivashankar
 
A Brief Introduction About Robert Paul Hardee
Robert Paul Hardee
 
Functions in Python Programming Language
BeulahS2
 
OOPS Concepts in Python and Exception Handling
Dr. A. B. Shinde
 
Información de microsoft purview herramienta de microsoft
macarenabenitez6
 
13th International Conference of Security, Privacy and Trust Management (SPTM...
ijcisjournal
 
NFPA 10 - Estandar para extintores de incendios portatiles (ed.22 ENG).pdf
Oscar Orozco
 
William Stallings - Foundations of Modern Networking_ SDN, NFV, QoE, IoT, and...
lavanya896395
 
darshai cross section and river section analysis
muk7971
 
Artificial Neural Network-Types,Perceptron,Problems
Sharmila Chidaravalli
 
L300 Technical Slide Library_Feb 2025 microsoft purview
macarenabenitez6
 
Authentication Devices in Fog-mobile Edge Computing Environments through a Wi...
ijujournal
 
FINAL plumbing code for board exam passer
MattKristopherDiaz
 
Footbinding.pptmnmkjkjkknmnnjkkkkkkkkkkkkkk
mamadoundiaye42742
 
Digital water marking system project report
Kamal Acharya
 
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
Pictorial Guide To Checks On Tankers' IG system
Mahmoud Moghtaderi
 
this idjfk sgfdhgdhgdbhgbgrbdrwhrgbbhtgdt
WaleedAziz7
 
Unit_I Functional Units, Instruction Sets.pptx
logaprakash9
 
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
Module - 5 Machine Learning-22ISE62.pdf
Dr. Shivashankar
 

microprocessor Lec 01 mic

  • 2. 05/09/15 Presentation By Sania Gul 2 Microprocessor & Microcomputer • The complete processor built on a single chip is called microprocessor (µP) or micro processing unit (MPU). • The computer built from microprocessor is called microcomputer
  • 3. 05/09/15 Presentation By Sania Gul 3 Architecture of Microcomputer Bus Architecture
  • 4. 05/09/15 Presentation By Sania Gul 4 MEMORY (Primary & Secondary) • Primary storage memory is made of RAM & ROM. • Secondary storage memory is Hard disk, Floppy disk, USB, CDs, DVDs etc. These devices store data so they are memory devices but for the microprocessor all secondary memory devices are I/O devices. For µP, memory is only the primary memory.
  • 5. 05/09/15 Presentation By Sania Gul 5 Peripherals • All I/O devices are called peripherals. • The µP, primary memory & the peripherals are connected to system bus and all the data exchange among them takes place over the system bus.
  • 6. 05/09/15 Presentation By Sania Gul 6 Primary Memory • The primary memory is a collection of lot of registers. One register of memory can hold any number of bits, but usually it is designed to hold 1 byte (8 bits). • The complete chip consists of lot of such register, each having different address by which µP calls it (or identifies it). • Remember, the number of registers in a memory chip are always in the power of 2. For example u have heard about kilo byte (KB), Mega Byte (MB), Giga Byte (GB) etc.
  • 7. 05/09/15 Presentation By Sania Gul 7 Primary Memory always in power of 2 1 KB 210 Bytes =1024 Bytes 1 MB 220 Bytes =1024 K Bytes 1GB 230 Bytes =1024 Mbytes 1 TB 240 Bytes =1024 GBytes
  • 8. 05/09/15 Presentation By Sania Gul 8 I/O peripherals • Well known I/O devices are printer, scanner, key board, mouse, joy stick etc. • The I/O devices are connected to system bus through peripheral interface IC called I/O controllers. (u can see these ICs on the mother board). • This IC or I/O controller consists of many registers & like memory each register inside the IC has a unique address & µP calls them by their address to exchange data with them.
  • 9. 05/09/15 Presentation By Sania Gul 9 Peripheral controller Hard disk, floppy disk, CD-R, DVD Modem, LAN Card Monitor, LCD, Multimedia
  • 10. 05/09/15 Presentation By Sania Gul 10 System bus • Bus is a group of wires that transmit a binary word. The system bus is composed of 3 buses. 1. Address bus 2. Data Bus 3. Control Bus
  • 11. 05/09/15 Presentation By Sania Gul 11 System bus 1. Address bus: The address bus is used to carry the address from micro-processor to peripheral or memory. The address generated by the µP is in the form of bits & each bus line carries one bit of address. It is a unidirectional bus. Each line is represented by “A” 2. Data Bus: The data from memory or peripheral to µP & vice versa is exchanged on data bus. It is a bidirectional bus. Each line is represented by “D”
  • 12. 05/09/15 Presentation By Sania Gul 12 System Bus 3. Control bus: This bus is used to carry control signals from µP to memory or peripherals & vice versa. It is not a bus in the true sense as it is not a common transmission medium to carry control signal. Every device is connected to microprocessor control pins individually. Multiplexed Bus: In order to reduce external pins, one pin can be shared to carry both address & data. But both are not carried at the same time. This kind of bus is called multiplexed bus, Each line is represented by “AD”. (address data)
  • 13. 05/09/15 Presentation By Sania Gul 13 Address decoding of 4 bit address This register is selected with address of 0 H and its contents are CD H
  • 14. 05/09/15 Presentation By Sania Gul 14 Memory with on chip address decoding
  • 15. 05/09/15 Presentation By Sania Gul 15 Memory Interfacing
  • 16. 05/09/15 Presentation By Sania Gul 16 Address space • The complete set of addresses which can be created from fix number of bits. e.g. with 4 bits only 24 (16) address can be created. The address range will be – 0000 = 0H (first address) note: addresses are always given in Hex format – 0001 =1H (Second address) – 1111 = FH (last address)
  • 17. 05/09/15 Presentation By Sania Gul 17 Address mapping • On maps of houses, we give particular location of a room, washrooms & kitchen. • Like wise allocating a unique address to any register or device on the address space is called address mapping. Memory address space
  • 18. 05/09/15 Presentation By Sania Gul 18 Memory Matrix
  • 19. 05/09/15 Presentation By Sania Gul 19 Inside Microprocessor • There are also registers inside the µP. Some special purpose registers & few data registers. The purpose of data registers is to store data & results. These results can afterwards be displayed on output devices or stored in memory for later use. • As there are very few registers inside processor so instead of address, they got names like register A, B, C etc. • The size of processor register defines how much maximum data, the processor can process at one time. For example the size of 8085 µP’s registers is 8 bit, so it is 8 bit processor & that of 8088/8086 is 16 bits, so it is 16 bit processor.
  • 20. 05/09/15 Presentation By Sania Gul 20 Inside Microprocessor
  • 21. 05/09/15 Presentation By Sania Gul 21 Performance Comparison of µPs • Performance of microprocessor is measured in units of MIPS how many million of instructions they can execute per second.
  • 22. 05/09/15 Presentation By Sania Gul 22 Primary memory Segmentation • Imagine u visit a library & there are no sections. All books are randomly placed. Can u find your required book easily? NO • Similarly the program (code) & data must be organized in different sections of memory to help the processor to find them easily, because it will reduce the processing time.
  • 23. 05/09/15 Presentation By Sania Gul 23 Types of Segments 4 types of segments exists in memory 1. Code Segment  for storing program 2. Data Segment  for storing Data 3. Stack Segment for storing Temporary Data 4. Extra Segment  for storing extra Data in addition to data in DS
  • 24. 05/09/15 Presentation By Sania Gul 24 Code Segment (CS) • It is that portion of memory which contains the program (Code). • The program is set of instructions. The µP fetches (picks) one instruction from the memory, decodes it to find what to do, & process the data according to the instruction. • So for each instruction 3 steps are performed • Fetch  Decode  Execute
  • 25. 05/09/15 Presentation By Sania Gul 25 Program Counter (PC) or Instruction pointer (IP) • Pointer means address. IP is a register inside microprocessor which holds the address of next instruction to be executed. • When the processor fetches one instruction from the memory, it automatically points to the next instruction in the memory which is to be executed after the current instruction. • It is like an office secretary who always points to his officer what to do next in his schedule. Its job is to send to the memory the address of the next instruction to be fetched & executed.
  • 26. 05/09/15 Presentation By Sania Gul 26 Stored program • The instructions are already stored by programmer in the memory. When the processor is turned on, it automatically takes first instruction from the memory because initially its IP or PC is 0H. • The instructions are stored in binary format in memory & one instruction may take one byte or many bytes of memory.
  • 27. 05/09/15 Presentation By Sania Gul 27 Sequential execution • Computer is a sequential machine i.e. it fetches instructions from memory and executes them in proper order. unless there is any instruction or external event (interrupt) which breaks the sequence. Main Program 1st instruction 2nd instruction 3rd instruction 4th instruction last instruction CPU memory Data bus Main Program 1st instruction 2nd instruction 3rd instruction 4th instruction last instruction
  • 28. 05/09/15 Presentation By Sania Gul 28 Instruction Cycle Instruction decoder & control unit Adder Inverter AND logic PC A B C 0H Add res s Contents 0H 80 H 1H 12 H 2H 40 H 3H 05 H 4H 75 H AH 06 H BH 01H MOV A,3H ADD A, 5H HLT 80 H12H 2H 3H ADD A,5H 4H Sum=8H Memory =16 Bytes Data Segment Code Segment 4 bit Address Bus 8 bit data bus RD control signal Note: if the instruction is of 2 bytes, it takes 2 Bus cycles to Fetch the instruction if the data Bus is 8 bit wide.
  • 29. 05/09/15 Presentation By Sania Gul 29 Instruction Cycle • Cycle means duration. The µP takes certain amount of time to execute the instruction. The time required varies from one processor to other & also depends on System Clock frequency f. • For example, the instruction ADD A, 5H takes 4 T states. • If the system clock frequency f=2 Hz, the • T=1/f = ½ =0.5 s • So ADD A, 5H  4 T = 4* 0.5= 2 s
  • 30. 05/09/15 Presentation By Sania Gul 30 Sub routines/ procedure or functions These are small programs written separately from the main program. These program are written separately because of many reasons like. 1. It makes programming modular, easy to debug, & allowing many programmers to work on small units of their interests. 2. The subroutine developed by one programmer can be used by other programmers in their own programs. 3. The subroutine can be called by main program many times without writing the sub routine code again & again so less memory is required. The program control is passed to subroutine when the main program calls it, & returned back to main program once the subroutine is finished.
  • 31. 05/09/15 Presentation By Sania Gul 31 Stack Segment (SS) • It is the portion of the RAM used for temporary storage of Data. • It is the data structure which works on LIFO (last in first out principle) like a stack of books. The last data pushed on the stack is the one which is popped first. • In Intel µPs, the stack storage starts from the highest address & continue towards the lower addresses. • In normal data structures the data is stored starting from the lowest address (the bottom) and continue towards the higher addresses even in Intel micro controller’s stack. Higher address Lower address Stack grows
  • 32. 05/09/15 Presentation By Sania Gul 32 Need of Stack Segment • When the main program calls sub routine, the program control shifts to sub routine & the Program counter PC is loaded with the address of the first instruction of sub routine. However at the end of subroutine, the control has to shifted back to the main program. • So before shifting the control to sub routine, the contents of PC are stored automatically on stack with the CALL instruction. And when the sub routine is over, the old contents of PC are automatically retrieved from the stack when the last instruction of sub-routine RET is executed & execution starts from the next instruction of the main program. which has called the sub-routine.
  • 33. 05/09/15 Presentation By Sania Gul 33
  • 34. 05/09/15 Presentation By Sania Gul 34 Need of Stack Segment • As there are very few registers inside µP, so it may be possible that the main program & sub-routine both require them. This is not possible if there was no stack. • So the programmer ensures that before the sub-routine uses the µP registers, the data inside these registers related to main program are stored on stack with the help of PUSH instructions & then POPPED from the stack at the end of sub-routine with the help of POP instruction. • The number of POPs instruction must be equal to number of PUSHES. • POPPING must be in reverse order of PUSHiNG to restore original contents due to LIFO principle.
  • 35. 05/09/15 Presentation By Sania Gul 35 Pushing means adding Popping means removing
  • 36. 05/09/15 Presentation By Sania Gul 36 Stack pointer • This register stores the address of the Top Of Stack (TOS), the top most valid filled location of SS. • As in Intel µPs, the stack grows from the higher address towards the lower one, so when the data is pushed on stack SP decrements & when it is popped from stack, SP increments.
  • 37. 05/09/15 Presentation By Sania Gul 37
  • 38. 05/09/15 Presentation By Sania Gul 38
  • 39. 05/09/15 Presentation By Sania Gul 39
  • 40. 05/09/15 Presentation By Sania Gul 40 Instruction pipelining • In old processors, one instruction is fetched, decoded & executed. After that the same process occurs for the second instruction & so on. • Fetching of the next instruction, while the current instruction executes is called pipelining. • This saves the time & increase processing speed.
  • 41. 05/09/15 Presentation By Sania Gul 41 BCD & Signed Numbers Unpacked BCD Packed BCD