Z8 Microcontrollers
Interrupts ZiLOG
7-12 UM001601-0803
7.6.2 Nesting of Vectored Interrupts
Nesting of vectored interrupts allows higher priority requests to
interrupt a lower priority request. To initiate vectored interrupt
nesting, do the following during the interrupt service routine:
• Push the old IMR on the stack.
• Load IMR with a new mask to disable lower priority
interrupts.
• Execute EI instruction.
• Proceed with interrupt processing.
• After processing is complete, execute DI instruction.
• Restore the IMR to its original value by returning the previous
mask from the stack.
• Execute IRET.
Depending on the application, some simplification of the above
procedure may be possible.
7.7 POLLED PROCESSING
Polled interrupt processing is supported by masking off the IRQ
to be polled. This is accomplished by clearing the corresponding
bits in the IMR.
To enable any interrupt, first the interrupt mechanism must be
engaged with an EI instruction. If only polled interrupts are to
be serviced, execute:
EI ;Enable interrupt mechanism
DI ;Disable vectored interrupts.
To initiate polled processing, check the bits of interest in the IRQ
using the Test Under Mask (TM) instruction. If the bit is set, call
or branch to the service routine. The service routine services the
request, resets its Request Bit in the IRQ, and branches or returns
back to the main program. An example of a polling routine is as
follows:
In this example, if IRQ2 is being polled, MASKA will be
00000100B and MASKB will be 11111011B.
7.8 RESET CONDITIONS
Upon reset, all bits in IPR are undefined.
In IMR, bit 7 is 0 and bits 0-6 are undefined. The IRQ register is
reset and held in that state until an enable interrupt (EI) instruc
-
tion is executed.
TM IRQ, #MASKA ;Test for request
JR Z, NEXT ;If no request go to NEXT
CALL SERVICE ;If request is there, then
;service it
NEXT:
.
.
.
SERVICE: ;Process Request
.
.
.
AND IRQ, #MASKB ;Clear Request Bit
RET ;Return to next