Interrupts
55
Specifications in this manual are tentative and subject to change
Rev. E
MITSUBISHI MICROCOMPUTERS
M30245 Group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Example 1:
INT_SWITCH1:
FCLR
I
:Disable interrupts.
AND.B
#00h, 0054h
;Clear TA0IC int. priority level and int. request bit.
NOP
;Four NOP instructions are required when using the HOLD function.
NOP
FSET
I
;Enable interrupts.
Example 2:
INT_SWITCH2:
FCLR
I
:Disable interrupts.
AND.B
#00h, 0054h
;Clear TA0IC int. priority level and int. request bit.
MOV.W
MEM, R0
;Dummy read.
FSET
I
;Enable interrupts.
Example 3:
INT_SWITCH3:
PUSHC
FLG
;Push Flag register onto stack
FCLR
I
;Diable interrupts.
AND.B
#00h, 0054h
;Clear TA0IC int. priority level and int. request bit.‘
POPC
FLG
;Enable interrupts.
The reason why two NOP instructions (four using the HOLD function) or a dummy read is inserted before "FSET I " in
Examples 1 and 2, is to prevent the interrupt enable flag I from being set before the interrupt control register is
rewritten due to the effects of the instruction queue.
Table 1.29.
Addresses in interrupt control register
Interrupt control register
Symbol
name
Address
Interrupt control register
Symbol
name
Address
Key input
KUPIC
004116
DMA2
DM2IC
005016
UART2 receive / ACK
S2RIC
004216
UART1 transmit / NACK / Serial
Sound Interface 1 transmit
SITIC
005116
UART1/UART3 Bus collision
S13BCNIC
004316
DMA3
DM3IC
005216
INT1
INT1IC
004416
UART0 transmit / NACK / Serial
Sound Interface 0 transmit
S0TIC
005316
Timer A1
TA1IC
004516
Timer A0
TA0IC
005416
USB EP0
EP0IC
004616
UART3 receive / ACK
S3RIC
005516
Timer A2
TA2IC
004716
USB Suspend
SUSPIC
005616
UART1 receive / ACK / Serial
Sound Interface 1 receive
S1RIC
004816
Timer A3
TA3IC
005716
UART0/UART2 Bus collision
S02BCNIC
004916
USB Resume
RSMIC
005816
UART0 receive / ACK / Serial
Sound Interface 0 receive
S0RIC
004A16
Timer A4
TA4IC
005916
A-D
ADIC
004B16
USB Reset
RSTIC
005A16
DMA0
DM0IC
004C16
USB SOF
SOFIC
005B16
UART3 transmit / NACK
S3TIC
004D16
USB Vbus Detect
VBDIC
005C16
DMA1
DM1IC
004E16
USB Function
USBFIC
005D16
UART2 transmit / NACK
S2TIC
004F16
INT2
INT2IC
005E16
INT0
INT0IC
005F16
Modifying the interrupt control registers
When modifying the interrupt control register, do so at a point that does not generate the interrupt
request for that register. If there is a possibility of the interrupt request occurring, access the interrupt
control register after the interrupt is disabled. See Figure 1.32 for examples of programs.
Figure 1.32. Program examples