173
8331B–AVR–03/12
Atmel AVR XMEGA AU
Figure 14-6.
Normal operation.
As shown in
, it is possible to change the counter value when the counter is running.
The write access has higher priority than count, clear, or reload, and will be immediate. The
direction of the counter can also be changed during normal operation.
Normal operation must be used when using the counter as timer base for the capture channels.
14.6.2
Event Action Controlled Operation
The event selection and event action settings can be used to control the counter from the event
system. For the counter, the following event actions can be selected:
• Event system controlled up/down counting
– Event n will be used as count enable
– Event n+1 will be used to select between up (1) and down (0). The pin configuration
must be set to low level sensing
• Event system controlled quadrature decode counting
14.6.3
32-bit Operation
Two timer/counters can be used together to enable 32-bit counter operation. By using two
timer/counters, the overflow event from one timer/counter (least-significant timer) can be routed
via the event system and used as the clock input for another timer/counter (most-significant
timer).
14.6.4
Changing the Period
The counter period is changed by writing a new TOP value to the period register. If double buff-
ering is not used, any period update is immediate, as shown in
CNT
BOTTOM
MAX
"update"
TOP
CNT written
DIR