2.4 Multi-Function Timer
94
Chapter 2: Hardware
The compare-clear register has its own buffer register, into which data is written for transfer to
the compare-clear register. When the timer is stopped, transfer occurs immediately when the data
is written to the buffer. When the timer is operating, data transfer from the buffer occurs when
the timer value is detected to be zero (as long as transfer is enabled).
When the comapre-clear register is set to 0000H in up-down count mode, no compare-clear
match can occur, and the timer will count to overflow.
(7) Zero-Detect Block Operation
Whenever the timer value reaches 0000H, the zero-detect block sends a zero-detect signal to the
count control block and zero detect pin control block, and at the same time sets the TZIR bit in
the TCSR register.
The count control block receives the zero detect signal and switches the count direction from
down-counting to up-counting.
(8) Zero-Detect Interrupt Mask Operation
The IME bit in the ZICR register can be set to ‘1’ to mask interrupt sources occurring from timer
zero-detection.
The number of maskings can be counted with the 4-bit reload counter, and from one to 15 times.
Each time a timer value of zero is detected, the mask count down begins, and when the count
value reaches 0000B, the next zero-detection will set the TZIR bit in the TCSR register. At this
point the predetermined value will be reloaded and the count will continue.
While this mask function is operating, it is not possible to rewrite the reload counter directly,
however the counter value can be overwritten through a buffer, to become effective at the next
reload cycle.
Note that because a zero-detect condition will occur even if the timer value is 0000H at startup,
the 4-bit counter will execute a count-down.
The count value is also reloaded when data is written to the ZICR register.
To disable this function, use a software instruction to write ‘0’ to the IME bit.
Also, if the mask cycle count is set to 0 times (0000B), no interrupt sources will be masked even
if the IME bit is set to ‘1.’
Fig. 2.4.7 Zero-detect Interrupt Mask Operation
Timer value
Example: Up-count mode, mask cycle = 2
Zero-detect
4-bit counter value
TZIR set
2
Start
1
0
2
1
0
2