English
Language : 

UPD784938 Datasheet, PDF (599/733 Pages) NEC – 16-Bit Single-Chip Microcontrollers
CHAPTER 23 INTERRUPT FUNCTIONS
23.12 Restoring Interrupt Function to Initial State
If an inadvertent program loop or system error is detected by means of an operand error interrupt, the watchdog timer,
NMI pin input, etc., the entire system must be restored to its initial state. In the µPD784938, interrupt acknowledgment
related priority control is performed by hardware. This interrupt acknowledgment related hardware must also be restored
to its initial state, otherwise subsequent interrupt acknowledgment control may not be performed normally.
A method of initializing interrupt acknowledgment related hardware in the program is shown below. The only way of
performing initialization by hardware is by RESET input.
Example
MOVW MK0, #0FFFFH; Mask all maskable interrupts
MOV MK1L, #0FFH
IRESL:
CMP ISPR, #0;
No interrupt service programs running?
BZ
$NEXT
MOVG SP, #RETVAL; Forcibly change SP location
RETI;
Forcibly terminate running interrupt service program, return
address = IRESL
RETVAL:
DW LOWW (IRESL); Stack data to return to IRESL with RETI instruction
DB
0
DB HIGHW (IRESL); LOWW & HIGHW are assembler operators for calculating low-order
16 bits & high-order 16 bits respectively of symbol NEXT
NEXT:
• It is necessary to ensure that a non-maskable interrupt request is not generated via the NMI pin
during execution of this program.
• After this, on-chip peripheral hardware initialization and interrupt control register initialization are
performed.
• When interrupt control register initialization is performed, the interrupt request flags must be
cleared (to 0).
Preliminary User’s Manual U13987EJ1V0UM00
599