
Rev.2.10 Apr 14, 2006 page 134 of 378
REJ09B0124-0210
M16C/6N Group (M16C/6NK, M16C/6NM) 13. Timers
Item Specification
Count source • External signals input to TBiIN pin (effective edge can be selected in program)
• Timer Bj overflow or underflow
Count operation • Down-count
• When the timer underflows, it reloads the reload register contents and
continues counting
Divide ratio 1/(n+1) n: set value of the TBi register 0000h to FFFFh
Count start condition Set TBiS bit
(1)
to 1 (count starts)
Count stop condition Set TBiS bit to 0 (count stops)
Interrupt request generation timing
Timer underflow
TBiIN pin function Count source input
Read from timer Count value can be read by reading the TBi register
Write to timer • When not counting and until the 1st count source is input after counting start
Value written to the TBi register is written to both reload register and counter
• When counting (after 1st count source input)
Value written to the TBi register is written to only reload register
(Transferred to counter when reloaded next)
13.2.2 Event Counter Mode
In event counter mode, the timer counts pulses from an external device or overflows and underflows of
other timers. Table 13.7 lists the Event Counter Mode Specifications. Figure 13.19 shows Registers
TB0MR to TB5MR in Event Counter Mode.
Table 13.7 Event Counter Mode Specifications
Figure 13.19 Registers TB0MR to TB5MR in Event Counter Mode
Timer Bi Mode Register (i= 0 to 5)
Symbol
Bit Name FunctionBit Symbol
RW
b7 b6 b5 b4 b3 b2 b1 b0
Operating mode select bits
0 1 : Event counter mode
b1 b0
TMOD1
TMOD0
MR0
Count polarity select bits
(1)
MR2
MR1
MR3
TCK1
TCK0
01
0 0 :
Counts falling edge of external signal
0 1 :
Counts rising edge of external signal
1 0 : Counts falling and rising edges of
external signal
1 1 : Do not set a value
b3 b2
NOTES:
1. Effective when the TCK1 bit = 0 (input from TBiIN pin). If the TCK1 bit = 1 (TBj overflow or underflow), these bits can
be set to 0 or 1.
2. The port direction bit for the TBiIN pin is set to 0 (input mode).
Has no effect in event counter mode.
Can be set to 0 or 1.
Event clock select bit
0 : Input from TBiIN pin
(2)
1 : TBj overflow or underflow
(j = i
–
1, except j = 2 if i = 0,
j = 5 if i = 3)
RW
RW
RW
RW
RW
-
RW
RW
RO
Registers TB0MR and TB3MR
Set to 0 in event counter mode
Registers TB1MR, TB2MR, TB4MR, and TB5MR
Nothing is assigned. If necessary, set to 0.
When read, the content is undefined.
If necessary, set to 0 in event counter mode.
When read in event counter mode, the content is undefined.
After Reset
TB0MR to TB2MR 00XX0000b
TB3MR to TB5MR 00XX0000b
Address
039Bh to 039Dh
01DBh to 01DDh
i = 0 to 5
j = i - 1, except j = 2 if i = 0, j = 5 if i = 3
NOTE:
1. Bits TB0S to TB2S are assigned to bits 5 to 7 in the TABSR register, and bits TB3S to TB5S are
assigned to bits 5 to 7 in the TBSR register.
Comentarios a estos manuales