www.geehy.com Page 102
Figure 26 Timing Diagram when Setting REPCNT=2 in Count-up Mode
CK_CNT
Counter
overrun
Update
event
Prescaler PSC
The 16-bit programmable prescaler can divide the clock frequency of the counter
by any value from 1 to 65536 (controlled by TMRx_PSC register). The clock after
frequency division will drive the counter CNT to count.
The prescaler has a buffer, which can be changed during running.
Input Capture
Input capture channel
The advanced timer has four independent capture/compare channels, each of
which is surrounded by a capture/compare register.
In the input capture, the measured signal will enter from the external pin T1/2/3/4
of the timer, first pass through the edge detector and input filter, and then into the
capture channel. Each capture channel has a corresponding capture register.
When the capture occurs, the value of the counter CNT will be latched in the
capture register CCx. Before entering the capture register, the signal will pass
through the prescaler, which is used to set how many events to capture at a time.
Input capture application
Input capture is used to capture external events, and can give the time flag to
indicate the occurrence time of the event and measure the pulse jump edge
events (measure the frequency or pulse width), for example, if the selected edge
appears on the input pin, the TMRx_CCx register will capture the current value of
the counter and the CCxIFLG bit of the state register TMRx_STS will be set to 1;
if CCxIEN=1, an interrupt will be generated.