Figure 35-10. Changing the Period Using Buffering
COUNT
MAX
New TOP written to
PER that is higher
than current
COUNT
" clear" update
" write"
ZERO
New TOP written to
PER that is lower
than current
COUNT
35.6.2.8. Capture Operations
To enable and use capture operations, the corresponding Capture Channel x Enable bit in the Control A
register (CTRLA.CAPTENx) must be written to '1'.
A capture trigger can be provided by input event line TC_EV or by asynchronous IO pin WO[x] for each
capture channel or by a TC event. To enable the capture from input event line, Event Input Enable bit in
the Event Control register (EVCTRL.TCEI) must be written to '1'. To enable the capture from the IO pin,
the Capture On Pin x Enable bit in CTRLA register (CTRLA.COPENx) must be written to '1'.
Note:
The RETRIGGER, COUNT and START event actions are available only on an event from the
Event System.
By default, a capture operation is done when a rising edge is detected on the input signal. Capture on
falling edge is available, its activation is depending on the input source:
•
When the channel is used with a IO pin, write a '1' to the corresponding Invert Enable bit in the
Drive Control register (DRVCTRL.INVENx).
•
When the channel is counting events from the Event System, write a '1' to the TC Event Input Invert
Enable bit in Event Control register (EVCTRL.TCINV).
For input capture, the buffer register and the corresponding CCx act like a FIFO. When CCx is empty or
read, any content in CCBUFx is transferred to CCx. The buffer valid flag is passed to set the CCx
interrupt flag (IF) and generate the optional interrupt, event or DMA request. CCBUFx register value can't
be read, all captured data must be read from CCx register.
Figure 35-11. Capture Double Buffering
BV
"capture"
IF
COUNT
CCBx
CCx
EN
EN
"INT/DMA
request"
data read
Atmel SAM L22G / L22J / L22N [DATASHEET]
Atmel-42402E-SAM L22G / L22J / L22N_Datasheet_Complete-07/2016
755