Rewrite The Interrupt Control Register; Watchdog Timer Interrupt - Renesas M16C/26A Series Hardware Manual

16-bit single-chip microcomputer m16c family / m16c/tiny series
Hide thumbs Also See for M16C/26A Series:
Table of Contents

Advertisement

M
1
6
C
2 /
6
A
G
o r
u
p
(
M
1
6

19.5.6 Rewrite the Interrupt Control Register

(1) The interrupt control register for any interrupt should be modified in places where no requests for that
interrupt may occur. Otherwise, disable the interrupt before rewriting the interrupt control register.
(2) To rewrite the interrupt control register for any interrupt after disabling that interrupt, be careful with the
instruction to be used.
Changing any bit other than the IR bit
If while executing an instruction, a request for an interrupt controlled by the register being modified
occurs, the IR bit in the register may not be set to "1" (interrupt requested), with the result that the
interrupt request is ignored. If such a situation presents a problem, use the instructions shown below
to modify the register.
Usable instructions: AND, OR, BCLR, BSET
Changing the IR bit
Depending on the instruction used, the IR bit may not always be cleared to "0" (interrupt not re-
quested). Therefore, be sure to use the MOV instruction to clear the IR bit.
(3) When using the I flag to disable an interrupt, refer to the sample program fragments shown below as
you set the I flag. (Refer to (2) for details about rewrite the interrupt control registers in the sample
program fragments.)
Examples 1 through 3 show how to prevent the I flag from being set to "1" (interrupts enabled) before the
interrupt control register is rewritten, due to the internal bus and the instruction queue buffer timing.
Example 1: Using the NOP instruction to keep the program waiting until the
interrupt control register is modified
INT_SWITCH1:
FCLR
AND.B
NOP
NOP
FSET
The number of NOP instruction is as follows.
PM20 = 1 (1 wait) : 2, PM20 = 0 (2 waits): 3
Example 2:Using the dummy read to keep the FSET instruction waiting
INT_SWITCH2:
FCLR
AND.B
MOV.W
FSET
Example 3:Using the POPC instruction to changing the I flag
INT_SWITCH3:
PUSHC
FCLR
AND.B
POPC

19.5.7 Watchdog Timer Interrupt

Initialize the watchdog timer after the watchdog timer interrupt occurs.
R
e
. v
2
0 .
0
F
e
b
1 .
, 5
2
0
0
7
R
E
J
0
9
B
0
2
0
2
0 -
2
0
0
C
2 /
6
, A
M
1
6
C
2 /
6
, B
M
1
6
I
; Disable interrupts
#00h, 0055h
;Set the TA0IC register to 00
;
I
; Enable interrupts
I
; Disable interrupts
#00h, 0055h
; Set the TA0IC register to 00
MEM, R0
; Dummy read
I
; Enable interrupts
FLG
I
; Disable interrupts
#00h, 0055h
; Set the TA0IC register to 00
FLG
; Enable interrupts
page 306
f o
3
2
9
C
2 /
6
) T
16
16
16
19. Usage Notes

Advertisement

Table of Contents
loading

This manual is also suitable for:

M16c/26aM16c/26bM16c/26t

Table of Contents