Serial Input
Serial Input
Interrupts
Interrupt is a process where an external device can get the attention of the microprocessor.
The process starts from the I/O device The process is asynchronous.
Classification of Interrupts
Interrupts can be classified into two types:
Maskable Interrupts (Can be delayed or Rejected) Non-Maskable Interrupts (Can not be delayed or Rejected)
Interrupts
An interrupt is considered to be an emergency signal that may be serviced.
The Microprocessor may respond to it as soon as possible.
RST 7.5
TRAP
Yes
No
Yes
Yes
8085 Interrupts
8085
Restart Sequence
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.
RST 6.5
RST 7.5
0034H
003CH
The vectors for these interrupt fall in between the vectors for the RST instructions. Thats why they have names like RST 5.5 (RST 5 and a half).
Bit 3 (Mask Set Enable - MSE) is an enable for setting the mask.
If it is set to 0 the mask is ignored and the old settings remain. If it is set to 1, the new setting are applied. The SIM instruction is used for multiple purposes and not only for setting interrupt masks.
It is also used to control functionality such as Serial Data Transmission. Therefore, bit 3 is necessary to tell the microprocessor whether or not the interrupt masks should be modified
Bit 4 of the accumulator in the SIM instruction allows explicitly resetting the RST 7.5 memory even if the microprocessor did not respond to it. Bit 5 is not used by the SIM instruction
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 - Disable 6.5 - Enable 7.5 - Allow setting the masks - Dont reset the flip flop - Bit 5 is not used - Dont use serial data - Serial data is ignored bit 0 = 0 bit 1 = 1 bit 2 = 0 bit 3 = 1 bit 4 = 0 bit 5 = 0 bit 6 = 0 bit 7 = 0 M5.5 M6.5 M7.5 MSE R7.5 XXX SOE SOD 0 0 0 0 1 0 1 0 Contents of accumulator are: 0AH
EI MVI A, 0A SIM
; Enable interrupts including INTR ; Prepare the mask to enable RST 7.5, and 5.5, disable 6.5 ; Apply the settings RST masks
Triggering Levels
RST 7.5 is positive edge sensitive.
When a positive edge appears on the RST7.5 line, a logic 1 is stored in the flip-flop as a pending interrupt. Since the value has been stored in the flip flop, the line does not have to be high when the microprocessor checks for the interrupt to be recognized. The line must go to zero and back to one before a new interrupt is recognized.
Pending Interrupts
Since the 8085 has five interrupt lines, interrupts may occur during an ISR and remain pending.
Using the RIM instruction, it is possible to can read the status of the interrupt lines and find if there are any pending interrupts. If an interrupt is pending the processor executes its interrupt service subroutine before it returns to the main program.