225
8.3 Structure of 8/16-bit Timer/Counter
Table 8.3-1 Timer 1 Control Register (T1CR) Bits
Bit
Function
Bit 7
T1IF:
Interrupt request
flag bit
8 bit-mode:
Set to "1" when the count in the timer 1 counter matches
the value set in the T1DR, the timer 1 data register
(comparison data latch).
16-bit mode:
Set to "1" when the counts in the timer 1 and timer 2
counters match the values set in the T1DR and T2DR
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
P22/TO is a general-purpose I/O port pin (P22) if both of
these bits are "00B". If either bit is "1", it is the square
wave output pin (TO).
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 TO pin.
If both bits are "11B", and the function is in the stop
timer state (T1STR= 0), the TO 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 1 operates as a
counter with the external clock is selected as the count
clock.
Check:
If external clock input is selected (T1CS1, T1CS0 =
11B), P20/EC must be set as an input port.
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
1STR:
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 1 and Timer 2 are
cleared at timer start (T1STP = 0 --> 1).