0% found this document useful (0 votes)
18 views

Microprocessor Unit 2

The document discusses interrupts on the 8085 microprocessor. It describes the interrupt process, including enabling interrupts, checking for interrupts during instruction execution, completing the current instruction before servicing the interrupt. It also describes saving the program counter on the stack and jumping to the interrupt vector table entry. The interrupt vector table redirects the processor to the interrupt service routine. Maskable and vectored interrupts are discussed. Methods for prioritizing interrupts from multiple devices are presented. The SIM and RIM instructions are described for modifying and reading the interrupt masks respectively.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Microprocessor Unit 2

The document discusses interrupts on the 8085 microprocessor. It describes the interrupt process, including enabling interrupts, checking for interrupts during instruction execution, completing the current instruction before servicing the interrupt. It also describes saving the program counter on the stack and jumping to the interrupt vector table entry. The interrupt vector table redirects the processor to the interrupt service routine. Maskable and vectored interrupts are discussed. Methods for prioritizing interrupts from multiple devices are presented. The SIM and RIM instructions are described for modifying and reading the interrupt masks respectively.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 77

Address Range

Interrupt name Maskable Vectored


INTR Yes No
RST 5.5 Yes Yes
RST 6.5 Yes Yes
RST 7.5 Yes Yes
TRAP No Yes
• An interrupt vector is a pointer to where the ISR is
stored in memory.
• All interrupts (vectored or otherwise) are mapped
onto a memory area called the Interrupt Vector
Table (IVT).
– The IVT is usually located in memory page 00 (0000H
- 00FFH).
– The purpose of the IVT is to hold the vectors that
redirect the microprocessor to the right place when an
interrupt arrives.
– The IVT is divided into several blocks. Each block is
used by one of the interrupts to hold its “vector”
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, the microprocessor will
complete the executing instruction, and start a
RESTART sequence.
4. The RESTART sequence resets the interrupt flip
flop and activates the interrupt acknowledge signal
(INTA).
5. Upon receiving the INTA signal, the interrupting
device is expected to return the op-code of one of
the 8 RST instructions.
6. When the microprocessor executes the RST
instruction received from the device, it saves the
address of the next instruction on the stack and
jumps to the appropriate entry in the IVT.
7. The IVT entry must redirect the microprocessor to
the actual service routine.
8. The service routine must include the instruction EI
to re-enable the interrupt process.
9. At the end of the service routine, the RET
instruction returns the execution to where the
program was interrupted.
• The restart sequence is made up of three machine
cycles
– In the 1st machine cycle:
• The microprocessor sends the INTA signal.
• While INTA is active the microprocessor reads the data lines
expecting to receive, from the interrupting device, the opcode
for the specific RST instruction.
– In the 2nd and 3rd machine cycles:
• the 16-bit address of the next instruction is saved on the stack.
• Then the microprocessor jumps to the address associated with
the specified RST instruction.
• How does the external device produce the
opcode for the appropriate RST instruction?
– The opcode is simply a collection of bits.
– So, the device needs to set the bits of the data
bus to the appropriate value in response to an
INTA signal.
• How do we allow multiple devices to
interrupt using the INTR line?
– The microprocessor can only respond to one
signal on INTR at a time.
– Therefore, we must allow the signal from only
one of the devices to reach the microprocessor.
– We must assign some priority to the different
devices and allow their signals to reach the
microprocessor according to the priority.
• The solution is to use a circuit called the priority
encoder (74366).
– This circuit has 8 inputs and 3 outputs.
– The inputs are assigned increasing priorities according
to the increasing index of the input.
• Input 7 has highest priority and input 0 has the lowest.
– The 3 outputs carry the index of the highest priority
active input.
– Figure 12.4 in the book shoes how this circuit can be
used with a Tri-state buffer to implement an interrupt
priority scheme.
• The figure in the textbook does not show the method for
distributing the INTA signal back to the individual devices.
INTR Circuit
Dev. 7 O7
INTA Circuit
O6 7
O5 RST Circuit
Dev. 6 O4 4
O3 1
O2 3 +5 V
Dev. 5 O1
O0
8
Dev. 4
INTA
INTR
Dev. 3
I7 AD7
8
I6 7 AD6
Dev. 2 I5 0
4 AD5
I4
AD4 8
I3 3
Dev. 1 AD3
I2
6 AD2 5
I1
Tri – AD1
I0 6 AD0
Dev. 0 State
Buffer
Priority
Encoder
• These three interrupts are masked at two
levels:
– Through the Interrupt Enable flip flop and the
EI/DI instructions.
• The Interrupt Enable flip flop controls the whole
maskable interrupt process.
– Through individual mask flip flops that control
the availability of the individual interrupts.
• These flip flops control the interrupts individually.
RST7.5 Memory
RST 7.5

M 7.5

RST 6.5

M 6.5

RST 5.5

M 5.5

INTR

Interrupt
Enable
Flip Flop
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.
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.
7 6 5 4 3 2 1 0

M5.5

SDE
XXX
R7.5
M7.5
M6.5

MSE

SDO
RST5.5 Mask
Serial Data Out 0 - Available
RST6.5 Mask
1 - Masked
RST7.5 Mask

Enable Serial Data Mask Set Enable


0 - Ignore bit 7 0 - Ignore bits 0-2
1 - Send bit 7 to SOD pin 1 - Set the masks according
to bits 0-2

Not Used Force RST7.5 Flip Flop to reset


Using the SIM Instruction to Modify the
Interrupt Masks
• Example: Set the interrupt masks so that
RST5.5 is enabled, RST6.5 is masked, and
RST7.5 is enabled.
– First, determine the contents of the accumulator
- Enable 5.5 bit 0 = 0
XXX

SDO
SDE
R7.5
MSE
M7.5
M6.5
M5.5

- Disable 6.5 bit 1 = 1


- Enable 7.5 bit 2 = 0
0 0 0 0 1 0 1 0
- Allow setting the masks bit 3 = 1
- Don’t reset the flip flop bit 4 = 0
- Bit 5 is not used bit 5 = 0 Contents of accumulator are: 0AH
- Don’t use serial data bit 6 = 0
- Serial data is ignored bit 7 = 0

EI ; Enable interrupts including INTR


MVI A, 0A ; Prepare the mask to enable RST 7.5, and 5.5, disable 6.5
SIM ; Apply the settings RST masks
• RIM instruction: Read Interrupt Mask
– Load the accumulator with an 8-bit pattern
showing the status of each interrupt pin and
mask.
RST7.5 Memory
RST 7.5
M 7.5
7 6 5 4 3 2 1 0

IE

SDI
RST 6.5

P7.5
P6.5
P5.5
M5.5

M7.5
M6.5
M 6.5

RST 5.5
M 5.5

Interrupt Enable
Flip Flop
7 6 5 4 3 2 1 0

IE

SDI
P6.5
P7.5
P5.5
M5.5

M7.5
M6.5
RST5.5 Mask
Serial Data In 0 - Available
RST6.5 Mask
1 - Masked
RST7.5 Mask
RST5.5 Interrupt Pending
RST6.5 Interrupt Pending
RST7.5 Interrupt Pending Interrupt Enable
Value of the Interrupt Enable
Flip Flop
• Example: Set the mask to enable RST6.5 without
modifying the masks for RST5.5 and RST7.5.
– In order to do this correctly, we need to use the RIM
instruction to find the current settings of the RST5.5
and RST7.5 masks.
– Then we can use the SIM instruction to set the masks
using this information.
– Given that both RIM and SIM use the Accumulator, we
can use some logical operations to masks the un-needed
values returned by RIM and turn them into the values
needed by SIM.
SDO SDI
SDE P7.5
XXX P6.5
R7.5 P5.5
MSE IE
M7.5 M7.5
M6.5 M6.5
M5.5 M5.5
Interrupt Masking Triggerin
Maskable Vectored Memory
Name Method g Method
Level
INTR Yes DI / EI No No
Sensitive
RST 5.5 / DI / EI Level
Yes Yes No
RST 6.5 SIM Sensitive
DI / EI Edge
RST 7.5 Yes Yes Yes
SIM Sensitive
Level &
TRAP No None Yes No Edge
Sensitive

You might also like