202
ยตPD750008 USER'S MANUAL
6.8 EFFECTIVE USE OF INTERRUPTS
The interrupt function can be used more effectively in the ways described below.
(1) MBE = 0 is set for the interrupt service routine
By allocating addresses 00H to 7FH as data memory used by the interrupt service routine and specifying
MBE = 0 in an interrupt vector table, the user can code a program without being concerned with a memory
bank.
If a program must use memory bank 1 for some reason, save the memory bank select register using the
PUSH BS instruction before selecting memory bank 1.
(2) Use different register banks for the normal routine and interrupt routine.
The normal routine uses register banks 2 and 3 with RBE = 1 and RBS = 2. If the interrupt routine is for
one nested interrupt, use register bank 0 with RBE = 0, so that you do not have to save or restore the
registers. When two or more interrupts are nested, set RBE to 1, save the register bank by using the PUSH
BS instruction, and set RBS to 1 to select register bank 1.
(3) Use of a software interrupt for debugging
Setting an interrupt request flag using an instruction has the same effect as the occurrence of an interrupt.
Debug operation for irregular interrupts or concurrently occurring interrupts can be performed more
efficiently by setting the interrupt request flags using an instruction.
6.9 INTERRUPT APPLICATIONS
To use the interrupt function, a main program must:
(a) Set a desired interrupt enable flag (using the EI IExxx instruction)
(b) Select an active edge when INT0 or INT1 is used (set IM0 or IM1)
(c) To use nesting (of an interrupt with the higher priority), set IPS (IME can be set at the same time).
(d) Set the interrupt master enable flag (IME) using the EI instruction
In the interrupt routine, MBE and RBE are set by the vector table. However, when the interrupt specified
as having the higher priority is processed, the register bank must be saved and set.
To return from the interrupt routine, use the RETI instruction.
*
*