204
CHAPTER 8 8/16-BIT TIMER/COUNTER
H
Count clock selectors 1 and 2
The count clock selectors 1 and 2 select the internal count clock. For Timer 1 in the 8-bit mode
or for the 16-bit mode, three types of internal clocks and one type of external clock can be
selected. For Timer 2 in the 8-bit mode, only three types of internal clocks can be selected.
H
Counter circuits 1 and 2
Each of the counter circuits 1 and 2 consists of the 8-bit counter, comparator, comparator data
latch, and data registers (T1DR, T2DR).
The 8-bit counter counts up according to the selected count clock. The comparator compares
the counter value and the comparator data latch value and, if there is a match, clears the
counter and sets (loads) the data register value in the comparator data latch.
In the 8-bit mode, the counter circuits 1 and 2 operate independently as Timers 1 and 2. In the
16-bit mode, the counter circuits 1 and 2 operate as one 16-bit counter with the former as the
lower 8-bit and the latter as the upper 8-bit.
H
Square wave output control circuit
If the comparator detects a match in the 8-bit or 16-bit mode, this circuit generates an interrupt
request. If the square wave output is enabled at this time, a corresponding output control circuit
reverses the output of the square wave output pin.
Additionally, the square wave output can be initialized either to the "L" or "H" level.
H
Timer data registers (T1DR, T2DR)
While writing, these registers are used to set data to be compared with the values in the 8-bit
counters. While reading, the current counter values in the counters are read.
H
Timer control registers (T1CR, T2CR)
Select a function, enable and disable the operation, control an interrupt, and check the status.
H
Interrupt of the 8/16-bit timer/counter
IRQE:
Generates an IRQE interrupt request if the interrupt request output is enabled (T1CR:
T1IE=1 for Timer 1 in the 8-bit mode or for the 16-bit mode or T2CR: T2IE=1 for Timer 2 in
the 8-bit mode) when the counter value becomes equal to the value in the data register
either in the interval timer or the counter function mode.