CHAPTER 5 INTERRUPT/EXCEPTION PROCESSING FUNCTION
User’s Manual U13850EJ4V0UM
155
Even when the EI instruction is executed, a period of time is required to identify an interrupt. Consequently, at
least seven clocks are required until an interrupt request is acknowledged after the EI instruction has been
executed. If the DI instruction is executed before the duration of the seven clocks elapses after the EI instruction
has been executed, therefore, the interrupt is held pending. To accurately acknowledge an interrupt, insert an
instruction that requires seven clocks or more to be executed in between the EI and DI instructions. However,
the following instructions are not included.
•
IDLE/STOP mode setting instructions
•
EI and DI instructions
•
RETI instruction
•
LDSR instruction (vs. PSW register)
•
Instruction that accesses interrupt control register (xxICn)
Example
When the EI instruction processing is not valid
[Program example]
DI
; MK flag = 0 (enables interrupt requests)
.
.
.
.
.
; Interrupt request occurs (IF flag = 1)
.
EI
JR LP1
; EI instruction
→
7 clocks have not elapsed before DI
instruction is executed
(3 clocks).
.
.
.
.
.
.
LP1:
DI
; Interrupt request is not acknowledged.
.
.
.
[Example of prevention program]
DI
; MK flag = 0 (enables interrupt requests)
.
.
.
.
.
; Interrupt request occurs (IF flag = 1)
.
EI
NOP
; 1 system clock
NOP
; 1 system clock
NOP
; 1 system clock
NOP
; 1 system clock
JR LP1:
; 3 system clocks (branches to LP1 routine)
.
.
.
.
.
.
DI
; Interrupt servicing is executed at the 8th system clock
after execution of
EI
instruction.
.
.
.