72
XMEGA A [MANUAL]
8077I–AVR–11/2012
6.5
Event Timing
An event normally lasts for one peripheral clock cycle, but some event sources, such as a low level on an I/O pin, will
generate events continuously. Details on this are described in the datasheet for each peripheral, but unless otherwise
stated, an event lasts for one peripheral clock cycle.
It takes a maximum of two peripheral clock cycles from when an event is generated until the event actions in other
peripherals are triggered. This ensures short and 100% predictable response times, independent of CPU or DMA
controller load or software revisions.
6.6
Filtering
Each event channel includes a digital filter. When this is enabled, an event must be sampled with the same value for a
configurable number of system clock cycles before it is accepted. This is primarily intended for pin change events.
6.7
Quadrature Decoder
The event system includes three quadrature decoders (QDECs), which enable the device to decode quadrature input on
I/O pins and send data events that a timer/counter can decode to count up, count down, or index/reset.
Table 6-2 onpage 72 summarizes which quadrature decoder data events are available, how they are decoded, and how they can be
generated. The QDECs and related features and control and status registers are available for event channels 0, 2, and 4.
Table 6-2.
Quadrature decoder data events.
6.7.1
Quadrature Operation
A quadrature signal is characterized by having two square waves that are phase shifted 90 degrees relative to each
other. Rotational movement can be measured by counting the edges of the two waveforms. The phase relationship
between the two square waves determines the direction of rotation.
Figure 6-4.
Quadrature signals from a rotary encoder.
Figure 6-4 shows typical quadrature signals from a rotary encoder. The signals QDPH0 and QDPH90 are the two
quadrature signals. When QDPH90 leads QDPH0, the rotation is defined as positive or forward. When QDPH0 leads
STROBE
DATA
Data Event User
Signaling Event User
0
No event
0
1
Index/reset
No event
1
0
Count down
Signaling event
1
Count up
Signaling event
00
10
11
01
QDPH0
QDPH90
QDINDX
Forward Direction
Backward
Direction
01
11
10
00
1 cycle / 4 states
QDPH0
QDPH90
QDINDX