R8C/13 Group
12.1 Timer (Timer X)
12.1.1 Timer Mode
In this mode, the timer counts an internally generated count source (See “Table 12.2 Timer Mode
Specifications”). Figure 12.4 shows the TXMR register in timer mode.
Table 12.2 Timer Mode Specifications
Item
Count source
Count operation
Specification
f1, f2, f8, f32
• Down-count
• When the timer underflows, the contents in the reload register is reloaded and the count
is contiuned.
Divide ratio
1/(n+1)(m+1)
n: set value of PREX register, m: set value of TX register
Count start condition
Count stop condition
Write “1” (count start) to TXS bit in TXMR register
Write “0” (count stop) to TXS bit in TXMR register
Interrupt request generation timing When Timer X underflows [Timer X interruption]
INT1/CNTR0 pin function
CNTR0 pin function
Read from timer
Programmable I/O port, or INT1 interrupt input
Programmable I/O port
Count value can be read by reading TX register
Same applies to PREX register.
Write to timer
Value written to TX register is written to both reload register and counter.
Same applies to PREX register.
Timer X mode register
b7 b6 b5 b4 b3 b2 b1 b0
Symbol
TXMR
Address
008B16
After reset
0016
0
0
0
0
0
0
RW
RW
Bit symbol
TXMOD0
Function
Bit name
b1 b0
Operation mode
select bit 0, 1
0 0 : Timer mode or pulse period
measurement mode
TXMOD1
R0EDG
RW
RW
RW
RW
RW
RW
RW
INT1/CNTR0 polarity
0 : Rising edge
1 : Falling edge
switching bit(1, 2)
Timer X count
start flag
0 : Stops counting
1 : Starts counting
TXS
TXOCNT
Must set to "0" in timer mode
Operation mode
select bit 2
TXMOD2
0 : Other than pulse period measurement mode
TXEDG
TXUND
Must set to "0" in timer mode
Must set to "0" in timer mode
NOTES:
1. The IR bit in the INT1IC register may be set to “1” (interrupt requested) when the R0EDG bit is rewritten.
Refer to the paragraph 19.2.5 “Changing Interrupt Factor” in the Usage Notes Reference Book.
2. This bit is used to select the polarity of INT1 interrupt in timer mode.
Figure 12.4 TXMR Register in Timer Mode
Rev.1.20 Jan 27, 2006 page 73 of 205
REJ09B0111-0120