EE6502MPMC1
EE6502MPMC1
EE6502MPMC1
1.
Hardware Architecture
Buses in 8085:
8
Has 8 data lines hence can connect to 2 ( 256 nos ) I/O pe iphe als
16
6
10
Has 16 address lines hence has a memory capacity of 2 bits ( 2 x 2 = 64 KB )
In address bus, the higher byte A8 A15 are unidirectional
The lower order Address & data lines are bidirectional
The lower byte of the address line (A0 A7) and all the 8 Data lines (D0-D7) are multiplexed & hence
termed (AD0 AD7)
When ALE (Address enable latch) is enabled (during the early part of the execution), address is passed
through the lines, else data is passed (during the late part of the execution).
Hence 8085 has Von Neumann (or Princeton) architecture instruction fetch (or address fetch) and data
operation share a common bus.
ALU Arithmetic and Logical unit:
is responsible for all the arithmetic and Logical operations of the Processor
depends on the Accumulator and the temporary registers for its internal operations
Accumulator:
Temporary Register:
Registers are RAM locations that can be accessed by the processor very easily.
They are
o B,C,D,E,H,L each have a capacity of 8 bits
o Can be used as 16 bit register pairs (BC , DE , HL pairs)
Stack Pointer:
Program Counter:
Flags:
They indicate the current condition of the processor. They are given as follows.
Zero Flag:
ZF = 1, if ALU result = 0.
Sign Flag:
SF = 1, if MSB of ALU = 1.
Parity Flag:
PF = 1, if ALU result has even parity.
Carry Flag:
CF = 1, if carry occurs.
Auxiliary Carry Flag: ACF = 1, if carry occurs from lover to higher nibble (useful internally for BCD addition)
The 8 bits of the accumulator + The 8 bits of the Flag are called = PSW
Hen e its a 16 it egiste
2.
Interrupts:
These are subroutines that the microprocessor responds to during its normal functioning.
Once the subroutine is responded to the microprocessor returns to the program with the help of stack
pointer and the stack.
The interrupts have priority assigned to them as given in the table.
Interrupts TRAP, RST 7.5, RST 6.5, RST 5.5 are called as Vector interrupts because their ISR are stored in
permanent locations as given in the table.
Masking can be termed as selective disabling- because the interrupts can be made active or inactive
depending on the needs and the concerns of the programmer. Interrupts RST 7.5, RST 6.5, RST 5.5 can be
masked.
TRAP is a non-maskable interrupt and has the highest priority assigned to it.
For INTR interrupt, (without the address of the service routine) is simply responded with an active low
signal INTA
There are 2 types of triggers to initiate the interrupts- thy are level triggered and edge triggered.
Hardware
Interrupts
Priority
Vector Address
Masking
Types of trigger
TRAP
RST 7.5
RST 6.5
RST 5.5
Highest
INTR
Lowest
0024 H
003C H
0034 H
002C H
Non Vector
Interrupt
3.
Mask-able
Level triggered
When the processor needs to be accessed again and again when performing a repeated data copying
operation, then
o to save time & power, control of the data transfer lines is given to the input device controller
o HOLD & HLDA are used for this process
HOLD is sent from I/O device to the processor asking for control of the data lines
HLDA is sent from processor to the I/O device acknowledging the transfer of the control of the data lines.
In DMA, there are 2 modes
o Burst Mode
o Cycle stealing
Monitor Routines:
Reset in and Reset out are called as Monitor Routines.
Reset in takes the pointer of the microprocessor to 0000 where some already programmed stuff is kept.
Reset out is used to announce, the microprocessor is being reset to its connected peripherals.
Ready pin is used to connect the microprocessor with slow peripherals.
The clock out is used to communicate the frequency of the microprocessor to its peripherals.
IO/M, RD, WR are the three active low control signals that combine together to form the four important
active low control instructions.
MEMR
MEMW
IOR
IOW
IO/M
RD
WR
4.
8086 Processor:
8086 architecture has 2 stage pipe-lining instruction execution. The central processing logic has been divided into
EU (Execution Unit)
o Tells BIU where to fetch the instructions or the data from
o Decodes the instructions received from the queue
o Executes the instructions
Hen e BIUs ueue helps EU to fun tion faste . When EU is e e uting an inst u tion, BIU is us fet hing
the next instruction for the queue. This is called pipe lining (or) Parallel Processing.
It Follows Von Neumann architecture, where the 16 data lines are multiplexed
Multiprocessing in 8086:
8086 has 2 modes of operation: Helps to manage single and multiprocessing environment.
It is the 8086 is the logical address that the program "thinks about" when it addresses a location in
memory. The Execution Unit (EU) is responsible for generating the offset address. The Bus Interface Unit
(BIU), on the other hand, takes the offset address and adds it to four times the selected segment register
value in order to determine a real address, which is now 20-bits in length.
Registers in 8086
It has 14 Sixteen Bit registers
Data Registers - (General Purpose but also has some special functions)
o Has 4 - Sixteen bit data registers
AX primary accumulator
BX used as base register while calculating data memory address
CX used to hold count in multi-iteration operations & loops
DX used in I/O instructions, multiply and divide instructions
o Upper and lower bytes are stored and addressed separately
o Hence can be used as 8 bit registers AH,AL,BH,BL,CH,CL,DH,DL
o Here L indicates lower; H indicates Higher; X indicates extended register
Segment Registers
o Additional Registers Used to generate memory address from the offset address in BIU
5.
Destination Index
Used to store offset of destination data in source segment
Instruction Pointer
Instruction Register
o Points to the next instruction to be executed.
used in string
manipulations
They indicate the current condition of the processor. They are given as follows.
Zero Flag:
ZF = 1, if ALU result = 0.
Sign Flag:
SF = 1, if MSB of ALU = 1.
Parity Flag:
PF = 1, if ALU result has even parity.
Carry Flag:
CF = 1, if carry occurs.
Auxiliary Carry Flag: ACF = 1, if carry occurs from lover to higher nibble (useful internally for BCD addition)
Trap Flag:
TF = 1, step by step error decoding is done
INTR Flag:
IF = 1, mask-able interrupt of INTR is enabled.
Direction Flag:
DF = 0, String is processed from lowest address to highest. Used for String
Manipulation
Overflow Flag
OF = 1, when over flow occurs as a result of signed operation
6.
8086 as Multiprocessor-
When a processor can be connected to work in cooperation with other processors in a connected
environment then it is termed as Multiprocessing.
(MN / MX) pin enables Multiprocessing in 8086. Hence 8086 has 2 states of operation.
o Minimum Mode
Active when (MN / MX) = 1, 8086 acts as a single processor
o Maximum Mode
Active when (MN / MX) = 0, 8086 acts as a Multiprocessor
8086 Interrupts:
These are subroutines that the microprocessor responds to during its normal functioning.
Once the subroutine is responded to the microprocessor returns to the program with the help of stack
pointer and the stack.
There are 2 types of interrupt in 8086 based on where they arise from
o External Interrupts Arises from outside the processor (Eg- from the peripheral devices)
o Internal Interrupts Arises from inside the processor
Masking can be termed as selective disabling- because the interrupts can be made active or inactive
depending on the needs and the concerns of the programmer. In 8086, Interrupts are classified again into
two types based on masking. They are
o NMI
Non Maskable interrupt interrupt cannot be masked.
o INTR Interrupt
Interrupt can be masked
8086 has Nested Interrupts
o That is - Interrupts can be interrupted by a higher order interrupt.
o This is enabled by the LIFO concept of the stack.
Serial Input Output port:SID and SOD:-These pins are used for serial data communication.
Interrupt Signal:Pin 6 to 11:- These pins are used for interrupt signals. Generally and external
devices are connected here which requests the microprocessor to perform a
particular task.
There are 5 pins for hardware interruptsTRAP, RST7.5, RST 6.5, RST5.5 and INTR
INTA is used for acknowledgement. Microprocessor sends the acknowledgement
to external devices through the INTA pin.
Address Bus and DATA Buses:AD0-AD7:-These are multiplexed address and data bus. So it can be used to carry
the lower order 8 bit address as well as the data. Generally these lines are
demultiplexed using the Latch.
During the opcode fetch operation, in the first clock cycle the lines deliever the
lower order address bus A0-A7.
In the subsequent IO/M read or write it is used as data bus D0-D7. CPU can read
or write data through these lines.
A8-A15:- These are address bus used to address the memory location.
10
11
12
13
14
15
16
ith o ly o e de i e at
LINEAR DECODING:
In small systems, h/w for the decoding logic can be eliminated by using individual high-order
address lines to select memory chips.
This is referred to as linear decoding.
The figure below shows the addressing of RAM with linear decoding technique.
This technique is also called partial decoding.
It reduces the cost of the decoding, but it has a drawback of multiple address (shadow
addresses)
EXAMPLE 1:
9) Consider a system in which the full memory space 64kb is utilized for EPROM
memory. Interface the EPROM with 8085 processor?
EXAMPLE 2:
10) Consider a system in which the available 64kb memory space is equally divided
between EPROM and RAM. Interface the EPROM and RAM with 8085 processor?
Implement 32kb memory capacity of EPROM using single IC 27256.
32kb RAM capacity is implemented using single IC 62256.
The 32kb memory requires 15 address lines and so the address lines A0 - A14 of the
processor are connected to 15 address pins of both EPROM and RAM.
The unused address line A15 is used as to chip select. If A15 is 1, it select RAM and
If A15 is 0, it select EPROM.
Inverter is used for selecting the memory.
The memory used is both Ram and EPROM, so the low RD and WR pins of processor
are connected to low WE and OE pins of memory respectively.
The address range of EPROM will be 0000H to 7FFFH and that of RAM will be
7FFFH to FFFFH.
EXAMPLE 3:
11). Consider a system in which 32kb memory space is implemented using four number
of 8kb memory. Interface the EPROM and RAM with 8085 processor?
The total memory capacity is 32Kb. So, let two number of 8kb n memory be EPROM
and the remaining two numbers be RAM.
Each 8kb memory requires 13 address lines and so the address lines A0- A12 of the
processor are connected to 13 address pins of all the memory.
The address lines and A13 - A14 can be decoded using a 2-to-4 decoder to generate
four chip select signals.
These four chip select signals can be used to select one of the four memory IC at any
one time.
The address line A15 is used as enable for decoder.
The simplified schematic memory organization is shown.
EXAMPLE 4:
12)Consider a system in which the 64kb memory space is implemented using eight
numbers of 8kb memory. Interface the EPROM and RAM with 8085 processor. ?
The total memory capacity is 64Kb. So, let 4 numbers of 8Kb EPROM and 4 numbers
of 8Kb RAM.
Each 8kb memory requires 13 address lines. So the address line A0 - A12 of the
processor are connected to 13address pins of all the memory ICs.
The address lines A13, A14 and A]5 are decoded using a 3-to-8 coder to generate
eight chip select signals. These eight chip select signals can be used to select one of
the eight memories at any one time.
The memory interfacing is shown in following figure.
14) A system requires 16kb EPROM and 16kb RAM. Also the system has 2
numbers of 8255, one number of 8279, one number of 8251 and one
number of 8254. (8255 - Programmable peripheral interface; 8279Keyboard/display controller, 8251 - USART and 8254 - Timer). Draw the
Interface diagram. Allocate addresses to all the devices. The peripheral IC
should be I/O mapped?
The I/O devices in the system should be mapped by standard I/O mapping. Hence
separate decoders can be used to generate chip select signals for memory IC and
peripheral IC's.
For 16kb EPROM, we can provide 2 numbers of 2764(8k x 8) EPROM.
For 16kb RAM we can provide 2 numbers of 6264 (8k x 8) RAM.
The 8kb memories require 13 address lines. Hence the address lines A0 - A12 are
used for selecting the memory locations.
The unused address lines A13, A14 and A15 are used as input to decoder 74LS138 (3to-8-deeoder) of memory IC. The logic low enables of this decoder are tied to IO/
M(low) of 8085, so that this decoder is enabled for memory read/write operation. The
other enable pins of decoder are tied to appropriate logic levels permanently. The 4outputs of the decoder are used to select memory lCs and the remaining 4 are kept for
future expansion.
The EPROM is mapped in the beginning of memory space from 0000H to 3FFF.
The RAM is mapped at the end of memory space from C000 to FFFFH.
There are five peripheral IC's to be interfaced to the system. The chip-select signals
for these IC's are given through another 3-to-8 decoder 74LS138 (I/O decoder). The
input to this decoder is A11, A12 and A13
The address lines A13, A14 and A15 are logically ORed and applied to low enable of
I/O decoder.
The logic high enable of I/O decoder is tied to IO / M(low) signal of 8085, so that this
decoder is enabled for I/O read/write operation.
Types of Interrupts:
It supports two types of interrupts.
Hardware
Software
Software interrupts:
The software interrupts are program instructions. These instructions are inserted at
desired locations in a program.
The 8085 has eight software interrupts from RST 0 to RST 7. The vector address for
these interrupts can be calculated as follows.
Interrupt number * 8 = vector address
For RST 5,5 * 8 = 40 = 28H
Vector address for interrupt RST 5 is 0028H
The Table shows the vector addresses of all interrupts.
Hardware interrupts:
An external device initiates the hardware interrupts and placing an appropriate
signal at the interrupt pin of the processor.
If the interrupt is accepted then the processor executes an interrupt service routine.
TRAP:
RST 7.5:
The RST 7.5 interrupt is a maskable interrupt.
It has the second highest priority.
It is edge sensitive. ie. Input goes to high and no need to maintain high state until it
recognized.
Maskable interrupt. It is disabled by,
1.DI instruction
2.System or processor reset.
3.After reorganization of interrupt.
Enabled by EI instruction.
RST 6.5 and 5.5:
The RST 6.5 and RST 5.5 both are level triggered. . ie. Input goes to high and stay
high until it recognized.
Maskable interrupt. It is disabled by,
1.DI, SIM instruction
2.System or processor reset.
3.After reorganization of interrupt.
Enabled by EI instruction.
The RST 6.5 has the third priority whereas RST 5.5 has the fourth priority.
INTR:
INTR is a maskable interrupt. It is disabled by,
1.DI, SIM instruction
2.System or processor reset.
3.After reorganization of interrupt.
Enabled by EI instruction.
Non- vectored interrupt. After receiving INTA (active low) signal, it has to supply the
address of ISR.
It has lowest priority.
It is a level sensitive interrupts. i.e. Input goes to high and it is necessary to maintain
high state until it recognized.
The following sequence of events occurs when INTR signal goes high.
1. The 8085 checks the status of INTR signal during execution of each
instruction.
2. If INTR signal is high, then 8085 complete its current instruction and sends
active low interrupt acknowledge signal, if the interrupt is enabled.
3. In response to the acknowledge signal, external logic places an instruction
OPCODE on the data bus. In the case of multibyte instruction, additional
interrupt acknowledge machine cycles are generated by the 8085 to transfer
the additional bytes into the microprocessor.
4. On receiving the instruction, the 8085 save the address of next instruction on
stack and execute received instruction.
The status of pending interrupts can be read from accumulator after executing RIM
instruction.
When RIM instruction is executed an 8-bit data is loaded in accumulator, which can
be interpreted as shown in fig.
Opcode fetch ..
Memory Read .
Memory Write .
I/O Read ..
I/O Write .
Interrupt Acknowledge
Bus Idle
4/6T
3T
3T
3T
3T
6 / 12 T
2/3T
16)Discuss the (i) Opcode fetch (ii) Memory Read (iii) Memory Write
(iv) I/O read and (v) I/O write machine cycles of 8085.