![](http://datasheet.mmic.net.cn/190000/UPD789304GK-XXX-9ET_datasheet_14990907/UPD789304GK-XXX-9ET_124.png)
CHAPTER 9 16-BIT TIMER 20
User’s Manual U14800EJ3V0UD
124
9.4 16-Bit Timer 20 Operation
9.4.1 Operation as timer interrupt
16-bit timer 20 can generate interrupts repeatedly each time the free-running counter value reaches the value set
to CR20. Since this counter is not cleared and holds the count even after an interrupt is generated, the interval time is
equal to one cycle of the count clock set in TCL201 and TCL200.
To operate 16-bit timer 20 as a timer interrupt, the following settings are required.
Set count values to CR20
Set 16-bit timer mode control register 20 (TMC20) as shown in Figure 9-4.
Figure 9-4. Settings of 16-Bit Timer Mode Control Register 20 at Timer Interrupt Operation
–
0/1
TOD20 TOF20 CPT201 CPT200 TOC20 TCL201 TCL200 TOE20
TMC20
Setting of count clock (see Table 9-2)
Caution
If both the CPT201 flag and CPT200 flag are set to 0, the capture edge becomes operation
disabled.
When the count value of 16-bit timer counter 20 (TM20) matches the value set to CR20, counting of TM20
continues and an interrupt request signal (INTTM20) is generated.
Table 9-2 shows the interval time, and Figure 9-5 shows the timing of the timer interrupt operation.
Caution
Process as follows when rewriting CR20 during a count operation.
<1> Set the interrupt to disabled (TMMK20 (bit 1of interrupt mask flag register 1(MK1) = 1)
<2> Set the inversion control of timer output data to disabled (TOC20 = 0)
If CR20 is rewritten while interrupts are enabled, an interrupt request may be generated at
that time.
Table 9-2. Interval Time of 16-Bit Timer 20
Count Clock
Interval Time
TCL201
TCL200
During fX = 5.0
MHz Operation
During fCC = 4.0
MHz Operation
During fX = 5.0
MHz Operation
During fCC = 4.0
MHz Operation
0
1/fX (0.2
s)
1/fCC (0.25
s)
2
16/fX (13.1 ms)
2
16/fCC (16.4 ms)
0
1
2
2/fX (0.8
s)
2
2/fCC (1.0
s)
2
18/fX (52.4 ms)
2
18/fCC (65.5 ms)
1
0
2
5/fX (6.4
s)
2
5/fCC (8.0
s)
2
21/fX (419.4 ms)
2
21/fCC (524.2 ms)
1
2
7/fX (25.6
s)
2
7/fCC (32
s)
2
23/fX (1.68 s)
2
23/fCC (2.10 ms)
Remarks 1. fX:
Main system clock oscillation frequency (ceramic/crystal oscillation)
2. fCC: Main system clock oscillation frequency (RC oscillation)