NEC PD78F9488 User Manual

Page 119

Advertising
background image

CHAPTER 6 16-BIT TIMER 20

User’s Manual U15331EJ4V1UD

119

<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

X

, CPU clock = f

X

)

TM20_VCT: SET1 TMMK20

; Disable timer interrupts

CLR1 TMC20.3

; Disable timer output inversion

MOVW A, #xxyyH

; Set the rewrite value of CR20

MOVW CR20, AX

; Rewrite CR20

NOP

NOP

:

; 16 NOP instructions (wait for 32/f

X

)

Note

NOP

NOP

CLR1 TMIF20

; Clear the interrupt request flag

CLR1 TMMK20

; Enable timer interrupts

SET1 TMC20.3

; Enable timer output inversion


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).

Advertising
This manual is related to the following products: