CHAPTER 8 TIMER/COUNTER FUNCTION
258
User’s Manual U15109EJ3V0UD
(2) Capture/compare register n0 (CR00, CR10, CR70 to CR120)
CRn0 is a 16-bit register that functions as both a capture register and a compare register. Whether this register
functions as a capture or compare register is specified by using bit 0 (CRCn0) of the CRCn register (n = 0, 1, 7 to
12).
(a) When using CRn0 as compare register
The value set to CRn0 is continually compared with the count value of the TMn register. When the values of
the two match, an interrupt request (INTTMn0) is generated. When TMn is used as an interval timer, CRn0
can also be used as the register that holds the interval time (n = 0, 1, 7 to 12).
(b) When using CRn0 as capture register
The valid edge of the TIn0 or TIn1 pin can be selected as a capture trigger. The valid edge for TIn0 or TIn1
is set by using the PRMn0 register.
When the valid edge for the TIn0 pin is specified as the capture trigger, refer to
Table 8-2
. When the valid
edge for the TIn1 pin is specified as the capture trigger, refer to
Table 8-3
(n = 0, 1, 7 to 12).
Table 8-2. Valid Edge of TIn0 Pin and Capture Trigger of CRn0
ESn01
ESn00
Valid Edge of TIn0 Pin
CRn0 Capture Trigger
0
0
Falling edge
Rising edge
0
1
Rising edge
Falling edge
1
0
Setting prohibited
Setting prohibited
1
1
Both rising and falling edges
No capture operation
Remark
n = 0, 1, 7 to 12
Table 8-3. Valid Edge of TIn1 Pin and Capture Trigger of CRn0
ESn11
ESn10
Valid Edge of TIn1 Pin
CRn0 Capture Trigger
0
0
Falling edge
Falling edge
0
1
Rising edge
Rising edge
1
0
Setting prohibited
Setting prohibited
1
1
Both rising and falling edges
Both rising and falling edges
Remark
n = 0, 1, 7 to 12
CRn0 is set using a 16-bit memory manipulation instruction.
When used as a compare register, CRn0 can be read/written, but when used as a capture register, CRn0
can only be read.
RESET input sets CRn0 to 0000H.
Caution
In the clear & start mode entered on a match between TMn and CRn0, set CRn0 to a value
other than 0000H. In the free-running mode or the TIn0 valid edge clear mode, however, an
interrupt request (INTTMn0) is generated after an overflow (FFFFH) when CRn0 is set to
0000H.