Rev.1.02 Jul 01, 2005 page 94 of 314
REJ09B0126-0102
M16C/6N Group (M16C/6NL, M16C/6NN) 12. Timers
Under development
This document is under development and its contents are subject to change.
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” (start counting)
Count Stop Condition Set the TAiS bit to “0” (stop counting)
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 ” (stop counting), the pin outputs a low.
12.1.1 Timer Mode
In timer mode, the timer counts a count source generated internally. Table 12.1 lists specifications in
timer mode. Figure 12.7 shows TAiMR register in timer mode.
Table 12.1 Specifications in Timer Mode
NOTE:
1.The port direction bit for the TAiIN pin is set to "0" (input mode).
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
Operation Mode
Select Bit
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 Bit
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
0 1 : f8
1 0 : f32
1 1 : fC32
b7 b6
TCK1
TCK0
Count Source Select Bit
00
0
RW
RW
RW
RW
RW
RW
RW
RW
}
Address
0396h to 039Ah
After Reset
00h
i = 0 to 4
Figure 12.7 TA0MR to TA4MR Registers in Timer Mode