Changing Interrupt Control Register - Renesas M16C FAMILY Hardware Manual

16-bit single-chip microcomputer
Hide thumbs Also See for M16C FAMILY:
Table of Contents

Advertisement

Under development
Preliminary specification
Specifications in this manual are tentative and subject to change.
R8C/11 Group

19.2.6 Changing Interrupt Control Register

(1) Each interrupt control register can only be modified while no interrupt requests corresponding to
that register are generated. If interrupt requests managed by any interrupt control register are
likely to occur, disable the interrupts before changing the interrupt control register.
(2) To modify any interrupt control register after disabling interrupts, be careful with the instructions
used.
When Changing Other Than IR Bit
If an interrupt request corresponding to that register is generated while executing the instruction, the
IR bit may not be set to "1" (interrupt requested), with the result that the interrupt request is ignored.
If this presents a problem, use the following instructions to modify the register.
Instructions to use: AND, OR, BCLR, BSET
When Changing IR Bit
Even when the IR bit is cleared to "0" (interrupt not requested), it may not actually be cleared to "0"
depending on the instruction used. Therefore, use the MOV instruction to set the IR bit to "0".
(3) When disabling interrupts using the I flag, set the I flag according to the following sample pro-
grams. Refer to #2 for the change of interrupt control registers in the sample programs.
Sample programs 1 to 3 are to prevent the I flag from being set to "1" (interrupt enabled) before writing
to the interrupt control registers for reasons of the internal bus or the instruction queue buffer.
Example 1: Use NOP instructions to prevent I flag being set to "1"
INT_SWITCH1:
FCLR
AND.B
NOP
NOP
FSET
Example 2: Use dummy read to have FSET instruction wait
INT_SWITCH2:
FCLR
AND.B
MOV.W MEM, R0
FSET
Example 3: Use POPC instruction to change I flag
INT_SWITCH3:
PUSHC FLG
FCLR
AND.B
POPC
Rev.0.91
2003 Sep 08
before interrupt control register is changed
I
; Disable interrupts
#00H, 0056H ; Set TXIC register to "00
I
; Enable interrupts
I
; Disable interrupts
#00H, 0056H ; Set TXIC register to "00
; Dummy read
I
; Enable interrupts
I
; Disable interrupts
#00H, 0056H ; Set TXIC register to "00
FLG
; Enable interrupts
page 172 of 184
"
16
"
16
"
16
19. Usage Notes

Advertisement

Table of Contents
loading

This manual is also suitable for:

R8c seriesTiny series

Table of Contents