Example 9.7.2. Using timer/counter 1 to calculate the period of a square wave on ICP1.
An example waveform applied to
ICP1 is shown in Figure 9.7.3, with ICES configured to trigger a capture event on a rising edge of the input signal. The timestamp at each rising edge is shown.
ICP1 with timestamps from TCNT1.If the prescaler of the timer/counter is equal to 64, and the clock frequency is 8 MHz, the period of the wave can be calculated as shown in (9.7.4).
\begin{equation}
T = (25-15) \times \frac{64}{8 \times 10^6~\textrm{Hz}} = 80~\mu\textrm{s}\tag{9.7.4}
\end{equation}
