R8C/13 Group
12.1 Timer (Timer X)
12.1 Timer X
The Timer X is an 8-bit timer with an 8-bit prescaler. Figure 12.1 shows the block diagram of Timer X.
Figures 12.2 and 12.3 show the Timer X-related registers.
The Timer X has five operation modes listed as follows:
• Timer mode:
The timer counts an internal count source .
• Pulse output mode:
The timer counts an internal count source and outputs the pulses
whose polarity is inverted at the timer the timer underflows.
The timer counts external pulses.
• Event counter mode:
• Pulse width measurement mode: The timer measures an external pulse's pulse width.
• Pulse period measurement mode:The timer measures an external pulse's period.
Data bus
TXCK1 to TXCK0
=00
2
f
f
f
1
Reload register
Reload register
TXMOD1 to TXMOD0
=00 or 012
=01
=10
=11
2
8
2
2
2
32
=11
2
f
2
Timer X interrupt
INT1 interrupt
Counter
Counter
PREX register
=10
2
TX register
TXS bit
Polarity
switching
INT1/CNTR0
TXMOD1 to TXMOD0 bits=01
2
R0EDG =1
R0EDG=0
Q
Q
CK
Toggle flip-flop
CLR
TXOCNT bit
Write to TX register
TXMOD1 to TXMOD0 bits=01
CNTR
0
2
Figure 12.1 Timer X Block Diagram
Timer X mode register
b7 b6 b5 b4 b3 b2 b1 b0
Symbol
TXMR
Address
008B16
After reset
0016
RW
Bit symbol
TXMOD0
Function
0 0 : Timer mode or
pulse period measurement mode
0 1 : Pulse output mode
Bit name
b1 b0
Operation mode
select bit 0, 1
RW
RW
RW
TXMOD1
R0EDG
1 0 : Event counter mode
1 1 : Pulse width measurement mode
INT1/CNTR0
polarity switching
bit(1)
Function varies with each operation mode
Timer X count
start flag
0 : Stops counting
1 : Starts counting
TXS
RW
RW
P30/CNTR0
Function varies with each operation mode
TXOCNT
select bit
Operation mode
select bit 2
0 : Except in pulse period measurement mode
1 : Pulse period measurement mode
TXMOD2
TXEDG
RW
RW
Active edge
reception flag
Function varies depending on each
operation mode.
Timer X under
flow flag
Function varies depending on each
operation mode.
TXUND
RW
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.
Figure 12.2 TXMR Register
Rev.1.20 Jan 27, 2006 page 71 of 205
REJ09B0111-0120