MPMC unit 1
MPMC unit 1
to
Microprocessor and Microcontrollers
Syllbus
• UNIT – I: Architecture of 8086Microprocessor
• UNIT – II: Instruction set of 8086:
• UNIT – III: Interfacing with 8086
• UNIT – IV: The 8051 Architecture
• UNIT – V: Instruction set of 8051
• UNIT VI: Applications of 8051
TEXT BOOKS :
• Advanced microprocessor & Peripherals - A.K.Ray&K.M.Bhurchandi, TMH,
2000.
• Microprocessors and interfacing – Douglas V. Hall, TMH, 2nd Edition, 1999.
Microprocessor and Microcontrollers
• Microprocessor ( CPU)
A processor, or "microprocessor,"
is a small chip that resides in
computers
Means small
• Processor means which executes
all instructions
Microcontroller
• A microcontroller (MCU
for microcontroller unit) is a small computer on
a single integrated circuit (IC) chip.
• A microcontroller contains one or more CPUs
(processor cores) along with memory and
programmable input/output peripherals.
8086 Microprocessor
What is a Microprocessor?
8086 18
Features of 8086
• The 20-bit address bus is time multiplexed:
• The lower order 16-bit address bus is time multiplexed
with data bus.
• The higher order 4-bit address bus is time multiplexed
with status signals.
• The maximum internal clock for 8086 is 5MHz.
• 8086 chip does not have the facility of internal clock
generation.
• (the INTEL 8284 clock generator/driver is used to
generate the clock signal for 8086 microprocessor
• The clock signal is divided by 3 in case of 8086 for
internal clock requirements.
8086 19
Features of 8086
• 8086 uses I/O mapped I/O techniques hence I/O devices are
accessed by using separate 16-bit address
• 8086 operates in two different modes
Minimum mode
( It works as a simple single processor system when configured
in minimum mode)
Maximum mode
( It works as a multiprocessor system i.e., along with math
coprocessor and I/O coprocessor when configured in maximum
mode)
8086 20
8086
Microprocessor
Overview
First 16- bit processor released by Addressable memory space is
INTEL in the year 1978 organized in to two banks of 512 kb
each; Even (or lower) bank and Odd (or
higher) bank. Address line A0 is used to
Originally HMOS, now manufactured select even bank and control signal
using HMOS III technique is used to access odd bank
21
Architecture
Microprocessor
Functional blocks
Various conditions of the
Computational Unit;
results are stored as
performs arithmetic and Internal storage of data
status bits called flags in
logic operations
flag register
24
Microprocessor Fifth Generation Pentium
Fourth Generation
During 1980s
Low power version of HMOS technology
(HCMOS)
Third Generation 32 bit processors
During 1978 Physical memory space 224 bytes = 16 Mb
HMOS technology Faster speed, Higher Virtual memory space 240 bytes = 1 Tb
packing density Floating point hardware
16 bit processors 40/ 48/ 64 pins Supports increased number of addressing
Easier to program modes
Dynamically relatable programs
Processor has multiply/ divide arithmetic Intel 80386
hardware
More powerful interrupt handling
capabilities Second Generation
Flexible I/O port addressing During 1973
NMOS technology Faster speed, Higher
Intel 8086 (16 bit processor) density, Compatible with TTL
4 / 8/ 16 bit processors 40 pins
First Generation Ability to address large memory spaces
Between 1971 – 1973 and I/O ports
PMOS technology, non compatible with TTL Greater number of levels of subroutine
4 bit processors 16 pins nesting
8 and 16 bit processors 40 pins Better interrupt handling capabilities
Due to limitations of pins, signals are 25
multiplexed Intel 8085 (8 bit processor)
Pins and signals
8086
Common signals
Microprocessor
Address/Data bus
27
8086
Common signals
Microprocessor
MN/ MX
MINIMUM / MAXIMUM
READY
CLK
31
8086
Minimum mode signals
Microprocessor
32
8086
Minimum mode signals
Microprocessor
33
8086
Maximum mode signals
Microprocessor
34
8086
Maximum mode signals
Microprocessor
35
8086
Maximum mode signals
Microprocessor
36
Architecture
Architecture of 8086 Microprocessor
8086
Microprocessor
Architecture
Architecture
Segment
Registers
8086’s 1-megabyte memory The 8086 can directly address four Programs obtain access to code
is divided into segments of segments (256 K bytes within the 1 and data in the segments by
up to 64K bytes each. M byte of memory) at a particular changing the segment register
time. content to point to the desired
segments.
43
8086
Bus Interface Unit (BIU)
Microprocessor
Architecture
Segment Code Segment Register
Registers
16-bit
CS contains the base or start of the current code segment; IP contains the
distance or offset from this address to the next instruction byte to be fetched.
BIU computes the 20-bit physical address by logically shifting the contents of CS
4-bits to the left and then adding the 16-bit contents of IP.
That is, all instructions of a program are relative to the contents of the CS
register multiplied by 16 and then offset is added provided by the IP.
44
8086
Bus Interface Unit (BIU)
Microprocessor
Architecture
Segment Data Segment Register
Registers
16-bit
Points to the current data segment; operands for most instructions are fetched
from this segment.
The 16-bit contents of the Source Index (SI) or Destination Index (DI) or a 16-bit
displacement are used as offset for computing the 20-bit physical address.
45
8086
Bus Interface Unit (BIU)
Microprocessor
Architecture
Segment Stack Segment Register
Registers
16-bit
The 20-bit physical stack address is calculated from the Stack Segment (SS) and
the Stack Pointer (SP) for stack instructions such as PUSH and POP.
In based addressing mode, the 20-bit physical stack address is calculated from
the Stack segment (SS) and the Base Pointer (BP).
46
8086
Bus Interface Unit (BIU)
Microprocessor
Architecture
Segment Extra Segment Register
Registers
16-bit
Points to the extra segment in which data (in excess of 64K pointed to by the
DS) is stored.
String instructions use the ES and DI to determine the 20-bit physical address
for the destination.
47
8086
Bus Interface Unit (BIU)
Microprocessor
Architecture
Segment Instruction Pointer
Registers
16-bit
48
49
Physical address calculations
50
51
52
8086
Bus Interface Unit (BIU)
Microprocessor
53
8086
Execution Unit (EU)
Microprocessor
A decoder in the EU
control system
translates instructions.
and
Some of the 16 bit registers can be
Index registers (Source used as two 8 bit registers as :
Index, Destination Index)
each of 16-bits AX can be used as AH and AL
BX can be used as BH and BL
CX can be used as CH and CL 54
DX can be used as DH and DL
Bus Interface Unit (BIU)
• Decoding of Instructions
• Execution of instructions
Steps
• EU extracts instructions from top of queue in BIU
• Decode the instructions
• Generates operands if necessary
• Passes operands to BIU & requests it to perform read or
write bus cycles to memory or I/O
• Perform the operation specified by the instruction on
operands
8086
Execution Unit (EU)
Microprocessor
Architecture
EU Accumulator Register (AX)
Registers
Consists of two 8-bit registers AL and AH, which can be
combined together and used as a 16-bit register AX.
58
8086
Execution Unit (EU)
Microprocessor
Architecture
EU Base Register (BX)
Registers
Consists of two 8-bit registers BL and BH, which can be
combined together and used as a 16-bit register BX.
59
8086
Execution Unit (EU)
Microprocessor
Architecture
EU Counter Register (CX)
Registers
Consists of two 8-bit registers CL and CH, which can be
combined together and used as a 16-bit register CX.
Example:
60
8086
Execution Unit (EU)
Microprocessor
Architecture
EU Data Register (DX)
Registers
Consists of two 8-bit registers DL and DH, which can be
combined together and used as a 16-bit register DX.
61
8086
Execution Unit (EU)
Microprocessor
Architecture
EU Stack Pointer (SP) and Base Pointer (BP)
Registers
SP and BP are used to access data in the stack segment.
62
8086
Execution Unit (EU)
Microprocessor
Architecture
EU Source Index (SI) and Destination Index (DI)
Registers
Used in indexed addressing.
63
8086
Execution Unit (EU)
Microprocessor
Architecture
EU Source Index (SI) and Destination Index (DI)
Registers
Used in indexed addressing.
64
8086
Execution Unit (EU)
Microprocessor
Flag Register
Architecture Auxiliary Carry Flag
lowest nibble, i.e, bit three during This flag is set, when there is
addition, or borrow for the lowest a carry out of MSB in case of
nibble, i.e, bit three, during addition or a borrow in case of
subtraction. subtraction.
This flag is set, when the This flag is set, if the result of This flag is set to 1, if the lower
result of any computation the computation or comparison byte of the result contains even
is negative performed by an instruction is number of 1’s ; for odd number
zero of 1’s set to zero.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OF DF IF TF SF ZF AF PF CF
Tarp Flag
Over flow Flag If this flag is set, the processor
This flag is set, if an overflow occurs, i.e, if the result of a signed enters the single step execution
operation is large enough to accommodate in a destination
mode by generating internal
register. The result is of more than 7-bits in size in case of 8-bit
signed operation and more than 15-bits in size in case of 16-bit interrupts after the execution of
sign operations, then the overflow will be set. each instruction
8086 registers
categorized 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
into 4 groups OF DF IF TF SF ZF AF PF CF
AX 16-bit Accumulator Stores the 16-bit results of arithmetic and logic operations
AL 8-bit Accumulator Stores the 8-bit results of arithmetic and logic operations
BX Base register Used to hold base value in base addressing mode to access memory
data
CX Count Register Used to hold the count value in SHIFT, ROTATE and LOOP instructions
DX Data Register Used to hold data for multiplication and division operations
SP Stack Pointer Used to hold the offset address of top stack memory
BP Base Pointer Used to hold the base value in base addressing using SS register to
access data from stack memory
SI Source Index Used to hold index value of source operand (data) for string
instructions
DI Data Index Used to hold the index value of destination operand (data) for string
operations
69
Minimum Mode 8086 System
• AEN and IOB are generally grounded. CEN pin is usually tied
to +5V. The significance of the MCE/PDEN output depends
upon the status of the IOB pin.
• If IOB is grounded, it acts as master cascade enable to control
cascade 8259A, else it acts as peripheral data enable used in
the multiple bus configurations.
• INTA pin used to issue two interrupt acknowledge pulses to
the interrupt controller or to an interrupting device.
Maximum Mode 8086 System Contd..
• IORC, IOWC are I/O read command and I/O write command
signals respectively . These signals enable an IO interface to
read or write the data from or to the address port.
• The MRDC, MWTC are memory read command and memory
write command signals respectively and may be used as
memory read or write signals.
• All these command signals instructs the memory to accept or
send data from or to the bus.
• For both of these write command signals, the advanced signals
namely AIOWC and AMWTC are available.
Maximum Mode 8086 System Contd..
• They also serve the same purpose, but are activated one clock
cycle earlier than the IOWC and MWTC signals respectively.
• The maximum mode system timing diagrams are divided in
two portions as read (input) and write (output) timing
diagrams.
• The address/data and address/status timings are similar to the
minimum mode.
• ALE is asserted in T1, just like minimum mode. The only
difference lies in the status signal used and the available
control and advanced command signals.
Block Diagram of Maximum Mode 8086 System
Maximum Mode 8086 System Contd..
• In T2, 8288 will set DEN=1 thus enabling transceivers, and for
an input it will activate MRDC or IORC. These signals are
activated until T4. For an output, the AMWC or AIOWC is
activated from T2 to T4 and MWTC or IOWC is activated
from T3 to T4.
• The status bit S0 to S2 remains active until T3 and become
passive during T3 and T4.
• If reader input is not activated before T3, wait state will be
inserted between T3 and T4.
Maximum Mode 8086 System Contd..