<Countermeasure B> When rewriting using 16-bit access
<1> Disable interrupts (TMMK20 = 1) and inversion control of timer output (TOC20 = 0).
<2> Rewrite CR20 (16 bits).
<3> Wait for one cycle or more of the count clock.
<4> Clear the interrupt request flag (TMIF20).
<5> Enable timer interrupts/timer output inversion
<Program example B> (count clock = 32/f
TM20_VCT:
SET1
TMMK20
CLR1
TMC20.3
MOVW
A, #xxyyH
MOVW
CR20, AX
NOP
NOP
:
NOP
NOP
CLR1
TMIF20
CLR1
TMMK20
SET1
TMC20.3
Note Clear the interrupt request flag (TMIF20) after waiting for one cycle or more of the count clock from the
instruction that rewrites CR20 (MOVW CR20, AX).
CHAPTER 6 16-BIT TIMER 20
, CPU clock = f
)
X
X
; Disable timer interrupts
; Disable timer output inversion
; Set the rewrite value of CR20
; Rewrite CR20
; 16 NOP instructions (wait for 32/f
; Clear the interrupt request flag
; Enable timer interrupts
; Enable timer output inversion
User's Manual U15331EJ4V1UD
Note
)
X
119