2683B–ATARM–03-10-03
Interrupt Generation Using the AT91
Timer/Counter
Introduction
This application note describes how to generate an Interrupt by using the
Timer/Counter (TC) in the AT91 series of microcontrollers.
Timer/Counter Overview
The AT91 series features a Timer/Counter block, which includes three identical 16-bit
timer counter channels. Each channel can be independently programmed, through its
two operating modes, to perform a wide range of functions including frequency mea-
surement, event counting, interval measurement, pulse generation, delay timing,
pulse width modulation and interrupt generation.
Each Timer Counter channel has 3 external clock inputs, 5 internal clock inputs, and 2
multi purpose input/output signals, which can be configured by the user. Each channel
drives an internal interrupt signal, which can be programmed to generate processor
interrupts via the Advanced Interrupt Controller (AIC). The three Timer Counter chan-
nels are independent and identical in operation. Each Timer Counter channel is
organized around a 16-bit counter. The value of the counter is incremented at each
positive edge of the selected clock. When the counter has reached the value 0xFFFF
and passes to 0x0000, an overflow occurs and the bit COVFS in TCx_SR (Status
Register) is set.
The current value of the counter is accessible in real-time by reading TCx_CV. A trig-
ger can reset the counter. In this case, the counter value passes to 0x0000 on the next
valid edge of the selected clock.
AT91 ARM
®
Thumb
®
Microcontroller
Application
Note