218
CHAPTER 8 8/16-BIT TIMER/COUNTER
8.5
8/16-bit Timer/Counter Interrupts
An interrupt of the 8/16-bit timer/counter is caused by a match of the data register
setting value and the count value both in the interval timer and counter operation
modes.
The 8/16-bit timer/counter generates an IRQE as an interrupt request.
I
8/16-bit Timer/Counter Interrupts
Table 8.5-1 "Interrupt Request Flag Bit and Interrupt Cause of the 8/16-bit Timer/Counter"
shows the relationship between an interrupt request flag bit, an interrupt request output enable
bit, and an interrupt cause of the 8/16-bit timer/counter.
An interrupt request of the 8/16-bit timer/counter is generated by Timers 1 and 2 independently
in the 8-bit mode and by Timer 1 in the 16-bit mode. However, the basic operation is the same
in both modes. This section describes the interrupt operation of Timer 1 in the 8-bit mode.
H
Interrupt operation of Timer 1 in the 8-bit mode
If the counter counts up from "00
H
" according to the selected count clock and matches the
setting value in the comparator data latch corresponding to the timer data register (T1DR), the
interrupt request flag bit (T1CR: T1IF) is set to "1".
If the interrupt request flag bit is set to Enabled (T1CR: T1IF=1) at this time, an interrupt request
(IRQE) occurs in the CPU. Use the interrupt processing routine to write "0" in the T1IF bit and
clear the interrupt request.
The T1IF bit is set to "1" regardless of the value in the T1IE bit if the counter value and the
setting value match.
Since Timers 1 and 2 operate independently in the 8-bit mode and generate the same interrupt
request (IRQE), the software may have to evaluate the interrupt request flag bit.
Note:
If the counter value and the T1DR register value match and the counter is stopped (T1CR:
STR1=0) at the same time, the T1IF bit is not set.
While the T1IF bit is "1", setting the T1IF bit from Disabled to Enabled (0 --> 1) immediately
causes an interrupt request.
Table 8.5-1 Interrupt Request Flag Bit and Interrupt Cause of the 8/16-bit Timer/Counter
8-bit mode
16-bit mode
Timer 1
Timer 2
Timers 1+2
Interrupt request flag bit
T1CR:T1IF
T2CR:T2IF
T1CR:T1IF
Interrupt request enable bit
T1CR:T1IE
T2CR:T2IE
T1CR:T1IE
Interrupt cause
A match of the T1DR
setting value and the
8-bit counter value
A match of the T2DR
setting value and the
8-bit counter value
A match of the T1DR and
T2DR setting value and the
16-bit counter value