232
CHAPTER 10 8/16-BIT TIMER/COUNTER
Note:
Before using 8/16-bit timer/counter Timer 11/21 only in 8 bit mode, first set the timer count clock
selection bits of the Timer 21/22 control register (T2/4CR: T2CS1, T2CS0) to some state other than
"11B". Operating in this mode without making this register setting could result in faulty operation.
Table 10.3-1 Timer 11/21 control register (T1/3CR) bits
Bit
Function
Bit 7
T1IF:
Interrupt request flag
bit
8 bit-mode:
Set to "1" when the count in the timer 11/21 counter matches the value set in the T1/
3DR, the timer 11/21 data register (comparison data latch).
16-bit mode:
Set to "1" when the counts in the timer 11/21 and timer 12/22 counters match the
values set in the T1/3DR and T2/4DR registers, respectively.
An interrupt request is output when both this bit and the interrupt request enable bit
(T1IE) are "1".
Writing "0"clears this bit. writing "1" has no effect and does not change the bit value.
Bit 6
T1IE:
Interrupt request
enable bit
This bit enables or disables an interrupt request output to the CPU.
An interrupt request is output when both this bit and the interrupt request flag bit
(T1IF) are "1".
Bit 5
Bit 4
T1OS1 and T1OS0:
square wave output
control bits
P15/TO1 or P17/TO2 is a general-purpose I/O port pin (P15, P17) if both of these bits
are "00B." If either bit is "1," it is the square wave output pin (TO1 or TO2).
If written to "01B," or "10B," the initialize data will be set in the square wave output
controller, but the corresponding level will not be output to the TO1 or TO2 pin.
If both bits are "11B," and the function is in the stop timer state (T2STR= 0), the TO1
or TO2 pin is set to a level corresponding to the initialize data.
Bit 3
Bit 2
T1CS1 and T1CS0:
Clock source
selection bits
Selects the count clock to be supplied to the counter.
Selects one of three internal clocks, or an external clock.
When both bits are "11B," Timer 11/21 operates as a counter with the external clock is
selected as the count clock.
Note:
If external clock input is selected (T1CS1, T1CS0 = 11B), Set the P14/EC1, P16/EC2
pin as an input port pin.
Bit 1
T1STP:
Timer stop bit
This bit is used to temporarily stop the counter.
Writing this bit to "1" temporarily stops the counter. Writing it to "0" when the timer in
startup state (T1STR = 1), restarts the counter where it left off.
Bit 0
T1STR:
Timer activation bit
Starts and stops timer.
Changing this bit from "0" to "1" clears the counter. At this time, if the timer is in the
continuous operation mode (T1STP = 0), the counter starts (counts up, clocked by the
selected count clock). Writing this bit to "0" stops the counter.
In the 16 bit mode, both Timer 11/21 and Timer 12/22 are cleared at timer start (T1STP =
0 --> 1).