UNIT 1 Microprocessor
UNIT 1 Microprocessor
COURSE HANDLED BY
Dr.V.Vijaya Baskar,Dr.M.R.Ebenezar Jebarani, Dr.S.Lakshmi,
Dr.P.Chitra,Dr.Aranganathan
School of EEE,
Sathyabama Institute of Science and Technology,
Chennai.
How to Achieve your Target
• You are eligible to give advise or Guide
• Remember that you have precious 1.5 years for learning
• Set your Target- Job, Salary, etc.
• Prepare yourself to achieve your target
• Set weekly target to reach your final target
• Think yourself in others position ( even for recruitment)
• Identify your domain and be strong in that domain
• Keep yourself away from the sources ,which are disturbing or wasting your time
(Bad Friends,Mobiles,etc.)
• At least two students can become entrepreneur-Lot of support available inside
the campus(TBI, Start up support, etc.)
• You have 1.5 years – Enough time to innovate a product- observe the
environment
SEC1201 –Microprocessors And Microcontrollers
Course objectives
To understand
The operation of microprocessors and
microcontrollers
COURSE OUTCOMES:
At the end of the course student will be able to
Remember the digital circuits (ALU, Registers, Counters, etc.)
Microcontroller (CO3.)
Identify the need for various interfacing ICs and understand its architecture
(CO4)
Compare the advantages of Microcontroller over Microprocessor while
Introduction to Microcontrollers
Difference Between Microprocessors and
Microcontrollers
Architectural Features of 8051
I/O Ports, Interrupts
Addressing Modes and
Instruction Set Of 8051
Programming Examples
UNIT 5 -Applications Based On 8085 And 8051
INTRODUCTION TO MICROPROCESSORS
Basic Concepts of Microprocessors
• These are devices that bring data into the system from the
outside world.
– Stored in memory:
• When a program is entered into a computer, it is
stored in memory. Then as the microprocessor
starts to execute the instructions, it brings the
instructions from memory one at a time.
Input Output
Memory
Inside The Microprocessor
manipulated.
Organization of a microprocessor- based system
I/O
Input / Output
ALU Register
Array
System
Bus
Control Memory
ROM RAM
Memory
• Memory stores information such as instructions and data in
binary format (0 and 1). It provides this information to the
microprocessor whenever it is needed.
0000 0000
F7FF
FFFF
Memory-Execute a program
• To execute a program:
Has 40 pins
Serial I/O
15
Registers (Contd.)
– General Purpose Registers
• B, C, D, E, H & L (8 bit registers)
• Can be used singly
• Or can be used as 16 bit register pairs
– BC, DE, HL
• H & L can be used as a data pointer (holds
memory address)
– Special Purpose Registers Accumulator
B
Flags
C
• Accumulator (8 bit register) D E
H L
– Store 8 bit data Program Counter
Stack Pointer
– Store the result of an operation
– Store 8 bit data during I/O transfer Address 16 8
Data
Registers (Contd.)
Temporary Register
8 bit register
During the arithmetic and logical operations one operand is
available in A and other operand is always transferred to
temporary register
For Eg.: ADD B – content of B is transferred into
temporary register before actual addition
Flag Register
Five flag is connected to ALU
After the ALU operation is performed the status of result will
be stored in five flags.
22
• Flag Register
– 8 bit register – shows the status of the microprocessor before/after an
operation
– S (sign flag), Z (zero flag), AC (auxiliary carry flag), P (parity flag)
& CY (carry flag)
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
– Sign Flag
• Used for indicating the sign of the data in the accumulator
17
• Zero Flag
– Is set if result obtained after an operation is 0
– Is set following an increment or decrement operation of that register
10110011
+ 01001101
1 00000000
• Carry Flag
– Is set if there is a carry or borrow from arithmetic
operation
This unit generates all the timing and control signals necessary for
communication between microprocessor and peripherals.
Clock (Crystal Oscillator)
Used
to increment or decrement the content of PC and SP
Address buffer
8 bit unidirectional buffer
Used to drive high order address bus(A8 to A15)
When it is not used under such as reset, hold and halt etc this buffer is used
tristate high order address bus.
Data/Address buffer
8 bit bi-Directional buffer
Used to drive the low order address (A0 to A7) and data (D0 to D7) bus.
Under certain conditions such as reset, hold and halt etc. this buffer is used
tristate low order address bus.
20
Signals or Pin Configuration of 8085
Pins
Power
Supply: +5 V
Frequency
Generator is
connected to
those pins
Input/Output/
Memory
Read
Write
Address latch
Multiplexed Enable
Address Data
Bus
Address
Bus
Signals of 8085
Address Bus
Data Bus
Control & Status Signals
Externally Initiated Signals
Serial I/O
Power supply and Frequency
8085 Pin Description
The 8085 is an 8-bit general purpose microprocessor that
can address 64K Byte of memory.
It has 40 pins and uses +5V for power. It can run at a maximum
frequency of 3 MHz.
The pins on the chip can be grouped into 6 groups:
Address Bus and Data Bus.
Status Signals.
Control signal
Interrupt signal
Power supply and Clock signal
Reset Signal
DMA request Signal
Serial I/O signal
The other 8 address lines A0 to A7 are multiplexed (time shared) with the
8 data bits.
– The high order bits of the address remain on the bus for three
clock periods. However, the low order bits remain for only one
clock period and they would be lost if they are not saved
externally. Also, notice that the low order bits of the address
disappear when they are needed most.
– To make sure we have the entire address for the full three
clock cycles, we will use an external latch to save the value of
AD7– AD0 when it is carrying the address bits. We use the ALE
signal to enable this latch.
Demultiplexing AD7-AD0
8085
A15-A8
ALE
Latch
AD7-AD0 A7- A0
D7- D0
31
Power supply and Clock Signal
Vcc (Pin 40) : single +5 volt power supply Vss (Pin 20) : Ground
There are 3 important pins in this group.
8085
CS
A15-A8
ALE
A9- A0 1K Byte
Latch Memory Chip
AD7-AD0 A7- A0
WR RD IO/M D7- D0
RD
WR
8085 Architecture …… cont….
In addition to register MP contains some latches and
buffer
Increment and
16 bitdecrement
register address latch
Used
to increment or decrement the content of PC and SP
Address buffer
8 bit unidirectional buffer
Used to drive high order address bus(A8 to A15)
When it is not used under such as reset, hold and halt etc this buffer is used
tristate high order address bus.
Data/Address buffer
8 bit bi-Directional buffer
Used to drive the low order address (A0 to A7) and data (D0 to D7) bus.
Under certain conditions such as reset, hold and halt etc this buffer is used
tristate low order address bus.
20
8085 Architecture …… cont….
(2) ALU & Logical Group: it consists ALU, Accumulator, Temporary
register and Flag Register.
(a) ALU
Performs arithmetic and logical operations
Stores result of arithmetic and logical operations in accumulator
(b) Accumulator
General purpose register
Stores one of the operand before any arithmetic and logical
operations and result of operation is again stored back in
Accumulator
Store 8 bit data during I/O transfer
21
8085 Programming register and
programming model
The register which are programmable and available for the use are six
Execute cycle
The actual actions which occur during the execute cycle of
an instruction.
Depend on both the instruction itself and the addressing mode
specified to be used to access the data that may be required.
38
Fetching an instruction
39
Fetching an instruction….Cont….
Step 2
40
Fetching an instruction….Cont….
Step 3
41
Fetching an instruction….Cont….
Step 4
42
Fetching an instruction….Cont….
Step 5
43
Fetching an instruction….Cont….
Step 6
44
Data flow from memory to MPU
Step 1: MPU places the 16 bit memory address from PC on the address bus
Step 2: Control unit send the signal RD to enable memory chip
Step 3: The byte from the memory location is placed on the data bus.
Step 4: The byte is placed on the instruction decoder of the MPU and task is
carried out according to the instruction.
Buses Structure
Various I/O devices and memories are connected to CPU by a group of lines
called as bus.
7
4
Introduction
It represents the execution time taken by each instruction in a graphical format.
It is the graphical representation of initiation of read/write and transfer of data
operations under the control of 3-status signals IO / M , S1, and S0. All the operation is
performed with respect to CLK signal.
The combination of these 3-status signals identify read or write operation and remain
valid for the duration of the cycle.
In the normal process of operation, the microprocessor fetches (receives or reads) and
executes one instruction at a time in the sequence until it executes the halt (HLT)
instruction.
Thus, an instruction cycle is defined as the time required to fetch and execute an
instruction.
Instruction Cycle (IC) = Fetch cycle (FC) + Execute Cycle (EC)
Processor Cycle
Instruction cycle
memory.
To differentiate this machine cycle from the very similar “memory read”
machine cycle.
Timing Diagram of Opcode Fetch
Step 1: At T1 higher order memory address 20H is placed on the A15 – A8 and the lower
order memory address 05H is placed on the bus AD7-AD0, and ALE signal high. IO/M goes
low(memory related signal).
Step 2: During T2 RD signal is sent out. RD is active during two clock periods.
Step 3 : During T3, Memory is enabled then instruction byte 4FH is placed on the data bus
and transferred to MPU. When RD goes high it causes the bus to go into high impedance
state.
Step 4: During T4, the machine code or byte is decoded by the instruction decoder and
content of A is copied into register.
Example: MOV C,A
Address:2005 , Opcode = 4F
Data Flow
form
Memory to
MP
85
Memory Read or Operand Fetch Machine Cycle
This cycle is executed by the processor to read a data byte from memory or
to fetch operand in a multi byte instruction. For ex. 2 or 3 byte instruction
because in 1 byte instruction the machine code is an opcode; so operation
is always an opcode fetch
The instructions which have more than one byte word size will use the
machine cycle after the opcode fetch machine cycle.
The memory read machine cycle is exactly the same as the opcode fetch
except:
IO/M= 0(memory operation),
s1 = 1 and s0 = 0. (memory read)
WR = 1 & RD = 0
It only has 3 T-states
89
Memory Write Machine Cycle
The memory write machine cycle is executed by the processor
to write a data byte in a memory location.
The memory write machine cycle is exactly the same as the
memory read except:
IO/M= 0(memory operation),
s1 = 0 and s0 = 1. (memory read
WR = 0 & RD = 1
It only has 3 T-states
96
Input/output write Machine Cycle
s0 = 1 and s1 = 1.
s0 = 1 and s1 = 1.
Timing Diagram of CALL instruction
Bus Idle Cycle
The MPU executes this cycle for internal operation.
Few situations where the machine cycle are neither read nor
write.
RST0 CALL
0000H
INTR
Dev. 7 O7
Circuit
O6 7
INTA Circuit
O5 4
Dev. 6 O4 RST Circuit
1
O3
3 +5 V
O2
Dev. 5
O1
8
O0
Dev. 4
INTA
Dev. 3
I7
INTR
AD7
8
I6
Dev. 2 7 AD6
I5
4
Dev. 1 I3 3
I4
0
AD5
I2 AD4
Tri –
Dev. 0
6 State
I1
I0 6
Priority
Buffer
8
AD3
Encoder
AD2
The 8085
Maskable/Vect
ored
Interrupts
• The 8085 has 4 Masked/Vectored interrupt
inputs.
– RST 5.5, RST 6.5, RST 7.5
• They are all maskable.
• They are automatically vectored according to the following
table: Interrupt Vector
RST 5.5 002CH
RST 6.5 0034H
RST 7.5 003CH
– The vectors for these interrupt fall in between the vectors for the RST
instructions. That’s why they have names like RST 5.5 (RST 5 and a
half).
Masking RST 5.5, RST 6.5 and
RST 7.5
RST7.5
Memory
RST 7.5
M 7.5
RST
6.5
M 6.5
RST
5.5
M 5.5
INT
R
Interrupt
Enable
Flip Flop
The 8085 Maskable/Vectored
Interrupt Process
1. The interrupt process should be enabled using the
EI instruction.
2. The 8085 checks for an interrupt during the
execution of every instruction.
3. If there is an interrupt, and if the interrupt is
enabled using the interrupt mask, the
microprocessor will complete the executing
instruction, and reset the interrupt flip flop.
4. The microprocessor then executes a call
instruction that sends the execution to the
appropriate location in the interrupt vector table.
The 8085 Maskable/Vectored
Interrupt Process
5. When the microprocessor executes the call
instruction, it saves the address of the next
instruction on the stack.
6. The microprocessor jumps to the specific service
routine.
7. The service routine must include the instruction
EI to re-enable the interrupt process.
8. At the end of the service routine, the RET
instruction returns the execution to where the
program was interrupted.
Manipulating the Masks
}
RST5.5
Serial Data Mask 1-
Out Available
RST6.5 Mask
2 - Masked
RST7.5 Mask
• The RST 7.5 interrupt is the only 8085 interrupt that has
memory.
– If a signal on RST7.5 arrives while it is masked, a flip flop will
remember the signal.
– When RST7.5 is unmasked, the microprocessor will be
interrupted even if the device has removed the interrupt signal.
– This flip flop will be automatically reset when the microprocessor
responds to an RST 7.5 interrupt.
RST
5.5
M 5.5
Interrupt Enable
Flip Flop
How RIM sets the
Accumulato
r’s different
7 6 5 4 3 2 1
0
bits
}
RST5.5 Mask
Serial Data In 1-
RST6.5 Mask
Available
RST7.5 Mask 2 - Masked
RST5.5 Interrupt
Pending RST6.5
Interrupt Pending Interrupt Enable
Value of the Interrupt
RST7.5 Interrupt
Enable Flip Flop
Pending
The RIM Instruction and
the Masks
ORI ;00001000 0 0 0 1 1
08H ; Set bit 4 for 0 0 0
MSE.
ANI ;00001101 0 0 0 0 1 0 0
0DH ; Turn off Serial Data, Don’t reset 0
; RST7.5 flip flop, and set the
mask
; for RST6.5 off. Don’t cares are
; assumed to be 0. 0 0 0 0 1 0 0 0
SIM ; Apply the
settings.
TRAP
SP
BH BL
BX
SI
CH CL
DI
CX
DH DL
DX Segment
CS
Flags DS
IP ES
General Purpose Registers
AX - the Accumulator
BX - the Base Register
CX - the Count Register
DX - the Data Register
• AX
– Accumulator Register
– Preferred register to use in arithmetic, logic
and data transfer instructions because it
generates the shortest Machine Language
Code
– Must be used in multiplication and division
operations
– Must also be used in I/O operations
• BX
– Base Register
– Also serves as an address register
General Purpose Registers
• CX
– Count register
– Used as a loop counter
– Used in shift and rotate operations
• DX
– Data register
– Used in multiplication and division
– Also used in I/O operations
Pointer and Index Registers
Overflow Carry
Direction Parity
AX AH AL Accumulator
EU registers BX BH BL Base Register
CX CH CL Count Register
DX DH DL Data Register
SP Stack Pointer
BP Base Pointer
SI Source Index Register
DI Destination Index Register
FLAGS
The Stack
Power Supply
5V 10%
Ground
Reset
Registers, seg
regs, flags
CS: FFFFH, IP:
0000H
If high for
minimum 4
Clock clks
Duty cycle: 33%
INTEL 8086 - Pin DETAILS
Address/Data Bus:
Contains address bits Address Latch Enable:
A15-A0 when ALE is 1
& data bits D15 – D0 When high,
multiplexed
when ALE is 0.
address/data bus
contains address
information.
INTEL 8086 - Pin DETAILS
INTERRUPT
Non - maskable
interrupt
Interrupt
acknowledge
Interrupt request
INTEL 8086 - Pin DETAILS
Direct
Memory
Access
Hold
Hold
acknowledge
INTEL 8086 - Pin DETAILS
Address/Status Bus
Address bits A19 –
A16 & Status bits S6 –
S3
INTEL 8086 - Pin DETAILS
1,1: No selection
INTEL 8086 - Pin DETAILS
Min/Max mode
Minimum Mode: +5V
Maximum Mode: 0V
Maximum Mode
Pins
Minimum Mode- Pin Details
Maximum Mode - Pin Details
S2 S1 S0
000: INTA
001: read I/O port
010: write I/O port
011: halt
100: code access
101: read memory
Status Signal
110: write memory
Inputs to 8288 to
111: none -passive
generate eliminated
signals due to max
mode.
Maximum Mode - Pin Details
Lock Output
Used to lock peripherals
off the system
DMA
Activated by using the
Request/Grant
LOCK: prefix on any
instruction
Lock Output
Maximum Mode - Pin Details
QS1 QS0
00: Queue is idle
01: First byte of opcode
10: Queue is empty
11: Subsequent byte of
opcode
Queue Status
Used by numeric
coprocessor (8087)
• MOV A, H
• MVI A,08
• LXI H,9100
• INR M
• LDA 9100
THANK YOU