Figure 20-6. Input Capture Pulse-Width Measurement
Event Input
Edge detector
MAX
CNT
BOTTOM
Restart
counter
Input Capture Frequency and Pulse-Width Measurement Mode
In this mode, the timer will start counting when a positive edge is detected on the even input signal. On
the following falling edge, the count value is captured. The counter stops when the second rising edge of
the event input signal is detected and this will set the interrupt flag.
Reading the capture will clear the interrupt flag. When the capture register is read or the interrupt flag is
cleared the TC is ready for a new capture sequence. Therefore, read the counter register before the
capture register since it is reset to zero at the next positive edge.
Figure 20-7. Input Capture Frequency and Pulse-Width Measurement
Event Input
Edge detector
MAX
CNT
BOTTOM
Start
counter
©
2018 Microchip Technology Inc.
Copy CNT to CCMP
and interrupt
Copy CNT to
CCMP
Datasheet Preliminary
megaAVR
16-bit Timer/Counter Type B (TCB)
Restart
Copy CNT to CCMP
counter
and give interrupt
Ignore till
Capture is read
Stop counter and
CPU reads the
CCMP register
interrupt
®
0-Series
" Interrupt "
Restart
counter
Trigger next
capture sequence
" Interrupt"
DS40002015A-page 239
Need help?
Do you have a question about the megaAVR 0 Series and is the answer not in the manual?
Questions and answers