
239
CHAPTER 10 8/16-BIT TIMER/COUNTER
10.4
8/16-bit Timer/Counter Interrupt
In the 8/16-bit timer/counter, interrupt conditions are satisfied (if interrupts are enabled)
when the counter matches the data register. This is true for both the interval timer and
counter functions.
I 8/16-bit timer/counter interrupt
Table 10.4-1 "8/16-bit timer/counter interrupt control bits and interrupts" lists the 8/16-bit timer/counter
interrupts, interrupt request flags and IRQ output enable bits.
In 8-bit mode, 8/16-bit timer/counter interrupt requests are generated independently for Timer 11/21 and
Timer 12/22. In 16-bit mode, the interrupt request is generated only for Timer 11/21, but basic operation is
the same. Interrupt operation will therefore be described only for Timer 11/21 in 8-bit mode.
G 8-bit mode timer 11/21 interrupt operation
The counter counts up from "00H", clocked by the selected count clock. When the count in the counter
matches the value in the comparison data latch (corresponding to the value in timer data register T1/3DR),
the interrupt request flag bit is set to "1" (T1/3CR: T1IF).
At this time, an interrupt request (IRQ7, 8) to the CPU is generated if the interrupt request enable bit is
enabled (T1/3CR: T1IE="1"). Write "0" to the T1IF bit in the interrupt processing routine to clear the
interrupt request.
The T1IF bit is set to "1" when the counter value matches the set value, regardless of the value of the T1IE
bit.
References:
The T1IF bit is not set if the counter is stopped (T1/3CR: T1STR = "0") at the same time as the counter
value matches the T1/3DR register.
An interrupt request is generated immediately if the T1IF bit is "1" when the T1IE bit is changed from
disabled to enabled ("0" --> "1").
Table 10.4-1 8/16-bit timer/counter interrupt control bits and interrupts
8-bit mode
16-bit mode
Timer 11/21 and Timer 12/22
Timer 11/21
Timer 12/22
Timer 11/21 + Timer 12/22
Interrupt request flag bit
T1/3CR:T1IF
T2/4CR:T2IF
T1/3CR:T1IF
interrupt request enable bit
T1/3CR:T1IE
T2/4CR:T2IE
T1/3CR:T1IE
Interrupt source
8-bit counter matches
T1/3DR
8-bit counter matches
T2/4DR
16-bit counter matches
T1/3DR+T2/4DR