English
Language : 

UPD784938 Datasheet, PDF (345/733 Pages) NEC – 16-Bit Single-Chip Microcontrollers
CHAPTER 11 TIMER/EVENT COUNTER 2
(3) Rewriting compare register (CR21)
If the current value of the CR21 is changed to a smaller value, and the CR21 value is made smaller than the timer counter
2 (TM2) value, the PPG cycle at that time will be extended to the time equivalent to a full-count by TM2. If CR21 is
rewritten after the compare register (CR20) and TM2 match, the output level at this time will be the inactive level until
TM2 overflows and becomes 0, and will then return to normal PPG output.
If CR21 is rewritten before CR20 and TM2 match, the active level will be output until CR20 and TM2 match. If CR20
and TM2 match before TM2 overflows and becomes 0, the inactive level is output at that point. When TM2 overflows
and becomes 0, the active level will be output, and normal PPG output will be restored.
CR21 rewriting should be performed by the interrupt due to a match between TM2 and CR21, etc.
Figure 11-33. Example of Extended PPG Output Cycle
Full count value
n1
TM2
count value
0H
CR20
n1
n3
n3
n1
n3
n5
n2
n2
n4
n4
CR21
n1
n2
TO2
When value n2 smaller than the TM2
value n5 is written to CR21 here, the
PPG cycle is extended.
TO2 becomes inactive level when
CR20 and TM2 match, otherwise
it remains at the active level.
Remark ALV2 = 1
Caution If the PPG cycle is extremely short as compared with the time required to acknowledge an interrupt,
the value of CR2n cannot be rewritten by interrupt processing that is performed on match between
timer counter 2 (TM2) and compare register (CR2n: n = 0, 1). Use another method (for example, to
poll the interrupt request flags by software with all the interrupts masked).
Preliminary User’s Manual U13987EJ1V0UM00
345