
Rev.2.10 Apr 14, 2006 page 119 of 378
REJ09B0124-0210
M16C/6N Group (M16C/6NK, M16C/6NM) 13. Timers
Item Specification
Count source f1, f2, f8, f32, fC32
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 TAi register 0000h to FFFFh
Count start condition Set the TAiS bit in the TABSR register to 1 (count starts)
Count stop condition Set the TAiS bit to 0 (count stops)
Interrupt request generation timing
Timer underflow
TAiIN pin function I/O port or gate input
TAiOUT pin function I/O port or pulse output
Read from timer Count value can be read by reading the TAi register
Write to timer • When not counting and until the 1st count source is input after counting start
Value written to the TAi register is written to both reload register and counter
• When counting (after 1st count source input)
Value written to the TAi register is written to only reload register
(Transferred to counter when reloaded next)
Select function • Gate function
Counting can be started and stopped by an input signal to TAiIN pin
• Pulse output function
Whenever the timer underflows, the output polarity of TAiOUT pin is inverted.
When TAiS bit is set to 0 (count stops), the pin outputs a low.
13.1.1 Timer Mode
In timer mode, the timer counts a count source generated internally.
Table 13.1 lists the Timer Mode Specifications. Figure 13.7 shows Registers TA0MR to TA4MR in Timer Mode.
Table 13.1 Timer Mode Specifications
NOTES:
1. The port direction bit for the TAiIN pin is set to 0 (input mode).
2. Selected by the PCLK0 bit in the PCLKR register.
Timer Ai Mode Register (i = 0 to 4)
Symbol
TA0MR to TA4MR
Bit Name FunctionBit Symbol RW
b7 b6 b5 b4 b3 b2 b1 b0
Operating mode
select bits
0 0 : Timer mode
b1 b0
TMOD1
TMOD0
MR0
Pulse output function
select bit
0 : Pulse is not output
(TAiOUT pin is a normal port pin)
1 : Pulse is output
(TAiOUT pin is a pulse output pin)
Gate function select bits
0 0
:
Gate function not available
0 1 : (TAiIN pin functions as I/O port)
1 0 : Counts while input on the TAiIN pin
is low
(1)
1 1 : Counts while input on the TAiIN pin
is high
(1)
b4 b3
MR2
MR1
MR3
Set to 0 in timer mode
0 0 : f1 or f2
(2)
0 1 : f8
1 0 : f32
1 1 : fC32
b7 b6
TCK1
TCK0
Count source select bits
000
RW
RW
RW
RW
RW
RW
RW
RW
}
Address
0396h to 039Ah
After Reset
00h
i = 0 to 4
Figure 13.7 Registers TA0MR to TA4MR in Timer Mode
Comentários a estes Manuais