Renesas M16C/6NK Technical Information Seite 372

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 412
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 371
Rev.2.10 Apr 14, 2006 page 348 of 378
REJ09B0124-0210
M16C/6N Group (M16C/6NK, M16C/6NM) 23. Usage Notes
23.8.6 Rewrite Interrupt Control Register
(a) The interrupt control register for any interrupt should be modified in places where no requests for that
interrupt may be generated. Otherwise, disable the interrupt before rewriting the interrupt control register.
(b) To rewrite the interrupt control register for any interrupt after disabling that interrupt, care must be
taken when selecting the instructions.
Changing any bit other than IR bit
If while executing an instruction, an interrupt request controlled by the register being modified is
generated, the IR bit of 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 IR bit
Depending on the instruction used, the IR bit may not always be set to 0 (interrupt not requested).
Therefore, be sure to use the MOV instruction to set the IR bit to 0.
(c) 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 (b) 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 (interrupt enabled) before the
interrupt control register is rewritten, owing to the effects of the internal bus and the instruction queue
buffer.
Example 1: Using the NOP instruction to keep the program waiting until the interrupt control register is modified
INT_SWITCH1:
FCLR I ; Disable interrupts.
AND.B #00h, 0055h ; Set the TA0IC register to 00h.
NOP ;
NOP
FSET I ; Enable interrupts.
The number of the NOP instruction is as follows.
The PM20 bit in the PM2 register = 1 (1 wait) : 2
The PM20 bit = 0 (2 waits) : 3
When using HOLD function : 4
Example 2: Using the dummy read to the FSET instruction delay
INT_SWITCH2:
FCLR I ; Disable interrupts.
AND.B #00h, 0055h ; Set the TA0IC register to 00h.
MOV.W MEM, R0 ; Dummy read.
FSET I ; Enable interrupts.
Example 3: Using the POPC instruction to changing the I flag
INT_SWITCH3:
PUSHC FLG
FCLR I ; Disable interrupts.
AND.B #00h, 0055h ; Set the TA0IC register to 00h.
POPC FLG ; Enable interrupts.
23.8.7 Watchdog Timer Interrupt
Initialize the watchdog timer after the watchdog timer interrupt request is generated.
Seitenansicht 371
1 2 ... 367 368 369 370 371 372 373 374 375 376 377 ... 411 412

Kommentare zu diesen Handbüchern

Keine Kommentare