English
Language : 

UPD784938 Datasheet, PDF (369/733 Pages) NEC – 16-Bit Single-Chip Microcontrollers
CHAPTER 11 TIMER/EVENT COUNTER 2
11.10 Cautions
(1) While timer/event counter 2 is operating (while the CE2 bit of the timer control register 1 (TMC1) is set), malfunctioning
may occur if the contents of the following registers are rewritten. This is because it is undefined which takes precedence,
change in the hardware functions due to rewriting the register, or the change in the status because of the function before
rewriting.
Therefore, be sure to stop the counter operation for the sake of safety before rewriting the contents of the following
registers.
• Prescaler mode register 1 (PRM1)
• Capture/compare control register 2 (CRC2)
• Timer output control register (TOC)
• CMD2 bit of timer control register 1 (TMC1)
(2) If the contents of the compare register (CR2n: n = 0, 1) match with those of TM2 when an instruction that stops timer
counter 2 (TM2) operation is executed, the counting operation of TM2 stops, but an interrupt request is generated.
In order not to generate the interrupt when stopping the operation of TM2, mask the interrupt in advance by using the
interrupt mask register before stopping TM2.
Example
Program that may generate interrupt request
Program that does not generate interrupt request
CLR1 CE2
← Interrupt request from
OR MK0H, #03H timer/event counter 2
occurs between these
instructions
OR MK0H, #03H
CLR1 CE2
CLR1 CIF20
CLR1 CIF21
← Disables interrupt from timer/event
counter 2
← Clears interrupt request flag for timer/
event counter 2
(3) Up to 1 count clock is required after an operation to start timer/event counter 2 (CE2 ← 1) has been performed before
timer/event counter 2 actually starts (refer to Figure 11-61).
For example, when using timer/event counter 2 as an interval timer, the first interval time is delayed by up to 1 clock.
The second and those that follow are at the specified interval.
Figure 11-61. Operation when Counting is Started
Count clock
TM2
0
0
1
2
3
CE2
Timing to start actual counting
Count start command (CE2 ← 1)
by software
Preliminary User’s Manual U13987EJ1V0UM00
369