CHAPTER 6 16-BIT TIMER/EVENT COUNTER
106
(1) 16-bit compare register (CR00)
CR00 is a 16-bit register where the value set in the CR00 is constantly compared with the 16-bit timer register
(TM0) count value, and interrupt request (INTTM0) is generated if they match.
It can also be used as the register which holds the interval time when TM0 is set to interval timer operation, and
as the register which sets the pulse width in the PWM operating mode.
CR00 is set with a 16-bit memory manipulation instruction. The value of 0001H to FFFFH can be set.
After RESET input, the value of CR00 is undefined.
Cautions
1.
The PWM data (14 bits) must be set in the upper 14 bits of CR00. The lower two bits must
be set to 00.
CR00 should be set to a valve other than 0000H. This means that when the timer is used
as an event counter, 1-pulse count operation is not available.
If the value after CR00 is changed is smaller than that of the 16-bit timer register (TM0),
TM0 continues counting, overflows, and then restarts counting from 0. Thus, if the value
after CR00 change is smaller than that before change, it is necessary to restart the timer
after changing CR00.
2.
3.
(2) 16-bit capture register (CR01)
CR01 is a 16-bit register capturing the content of 16-bit timer (TM0).
Capture trigger is INTP0/TI0 pin valid edge input. Setting of INTP0 valid edge is operated with the external
interrupt mode register (INTM0).
CR01 is read with a 16-bit memory manipulation instruction.
After RESET input, the value set of CR01 is undefined.
Caution
If the active edge for the TI0/P00 pin is input during a read from CR01, CR01 does not perform
the capture operation and holds the previous data. In this case, however, the interrupt request
flag (PIF0) is set because an active edge is detected.
(3) 16-bit timer register (TM0)
TM0 is a 16-bit register counts count pulse.
TM0 is read with a 16-bit memory manipulation instruction.
After RESET input, the value of TM0 is 0000H.
Caution
As reading of the value of TM0 is performed via CR01, the previously set value of CR01 is lost.