English
Language : 

UPD784938 Datasheet, PDF (544/733 Pages) NEC – 16-Bit Single-Chip Microcontrollers
CHAPTER 23 INTERRUPT FUNCTIONS
23.4 Software Interrupt Acknowledgment Operations
A software interrupt is acknowledged in response to execution of a BRK or BRKCS instruction. Software interrupts cannot
be disabled.
23.4.1 BRK instruction software interrupt acknowledgment operation
When a BRK instruction is executed, the program status word (PSW), program counter (PC) are saved in that order to
the stack, the IE flag is cleared (to 0), the vector table (003EH/003FH) contents are loaded into the low-order 16 bits of
the PC, and 0000B into the high-order 4 bits, and a branch is performed (the start of the service program must be in the
base area).
The RETB instruction must be used to return from a BRK instruction software interrupt.
Caution The RETI instruction must not be used to return from a BRK instruction software interrupt.
23.4.2 BRKCS instruction software interrupt (software context switching) acknowledgment operation
The context switching function can be initiated by executing a BRKCS instruction.
The register bank to be used after context switching is specified by the BRKCS instruction operand.
When a BRKCS instruction is executed, the program branches to the start address of the interrupt service program (which
must be in the base area) stored beforehand in the specified register bank, and the contents of the program status word
(PSW) and program counter (PC) are saved in the register bank.
Figure 23-7. Context Switching Operation by Execution of a BRKCS Instruction
0000B
7 Transfer
PC19 to16
PC15 to 0
2 Save
(bits 8 to 11 of
temporary register)
6 Exchange
5 Save
Temporary register
1 Save
PSW
Register bank n (n = 0 to 7)
A
X
Register bank
(0 to 7)
B
C
R5
R4
R7
R6
V
VP
3 Register bank switching
U
UP
(RBS0 to RBS2 ← n)
T
W
D
H
E
L
( ) 4 RSS ← 0
IE ← 0
The RETCSB instruction is used to return from a software interrupt due to a BRKCS instruction. The RETCSB instruction
must specify the start address of the interrupt service program for the next time context switching is performed by a BRKCS
instruction. This interrupt service program start address must be in the base area.
Caution The RETCS instruction must not be used to return from a BRKCS instruction software interrupt.
544
Preliminary User’s Manual U13987EJ1V0UM00