English
Language : 

UPD784938 Datasheet, PDF (268/733 Pages) NEC – 16-Bit Single-Chip Microcontrollers
CHAPTER 9 TIMER/EVENT COUNTER 0
9.9 Cautions
(1) While timer/event counter 0 is operating (while the CE0 bit of the timer control register 0 (TMC0) is set), malfunctioning may
occur if the contents of the following registers are rewritten. This is because it is undefined which takes precedence in a
contention the 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 0 (PRM0)
• Capture/compare control register 0 (CRC0)
• Timer output control register (TOC)
(2) If the contents of the compare register (CR0n: n = 0, 1) coincide with those of TM0 operation when an instruction that stops
timer counter 0 (TM0) operation is executed, the counting operation of TM0 stops, but an interrupt request is generated.
In order not to generate the interrupt when stopping the operation of TM0, mask the interrupt in advance by using the
interrupt mask register before stopping TM0.
Example
Program that may generate interrupt request
Program that does not generate interrupt request
CLR1 CE0
OR MK0L, #30H
← Interrupt request from
timer/event counter 0
occurs between these
instructions
OR
CLR1
CLR1
CLR1
MK0L, #30H
CE0
CIF00
CIF01
← Disables interrupt from
timer/event counter 0
← Clears interrupt request flag
for timer/event counter 0
(3) Up to 1 count clock is required after an operation to start timer/event counter 0 (CE0 ← 1) has been performed before timer/
event counter 0 actually starts (refer to Figure 9-52).
For example, when using timer/event counter 0 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 9-52. Operation when Counting is Started
Count clock
TM0
CE0
0
0
1
2
3
Timing to start actual counting
Count start command (CE0 ← 1) by software
268
Preliminary User’s Manual U13987EJ1V0UM00