dsPIC30F Family Reference Manual
DS70060C-page 13-4 © 2004 Microchip Technology Inc.
13.3 Timer Selection
Each dsPIC30F device may have one or more input capture channels. Each channel can select
between one of two 16-bit timers for the time base. Refer to the device data sheet for the specific
timers that can be selected.
Selection of the timer resource is accomplished through the ICTMR control bit (ICxCON<7>).
The timers can be setup using the internal clock source (F
OSC/4), or using a synchronized
external clock source applied at the TxCK pin.
13.4 Input Capture Event Modes
The input capture module captures the 16-bit value of the selected time base register when an
event occurs at the ICx pin. The events that can be captured are listed below in three categories:
1. Simple Capture Event modes
• Capture timer value on every falling edge of input at ICx pin
• Capture timer value on every rising edge of input at ICx pin
2. Capture timer value on every edge (rising and falling)
3. Prescaler Capture Event modes
• Capture timer value on every 4th rising edge of input at ICx pin
• Capture timer value on every 16th rising edge of input at ICx pin
These Input Capture modes are configured by setting the appropriate Input Capture mode bits,
ICM<2:0> (ICxCON<2:0>).
13.4.1 Simple Capture Events
The capture module can capture a timer count value (TMR2 or TMR3) based on the selected
edge (rising or falling defined by mode) of the input applied to the ICx pin. These modes are
specified by setting the ICM<2:0> (ICxCON<2:0>) bits to ‘010’ or ‘011’, respectively. In these
modes, the prescaler counter is not used. See Figure 13-3 and Figure 13-2 for simplified timing
diagrams of a simple capture event.
The input capture logic detects and synchronizes the rising or falling edge of the capture pin
signal on the internal phase clocks. If the rising/falling edge has occurred, the capture module
logic will write the current time base value to the capture buffer and signal the interrupt generation
logic. When the number of elapsed capture events matches the number specified by the ICI<1:0>
control bits, the respective capture channel interrupt status flag, ICxIF, is asserted 2 instruction
cycles after the capture buffer write event.
If the capture time base increments every instruction cycle, the captured count value will be the
value that was present 1 or 2 instruction cycles past the time of the event on the ICx pin. This
time delay is a function of the actual ICx edge event related to the instruction cycle clock and
delay associated with the input capture logic. If the input clock to the capture time base is
prescaled, then the delay in the captured value can be eliminated. See Figure 13-3 and
Figure 13-2 for details.
The input capture pin has minimum high time and low time specifications. Refer to the “Electrical
Specifications” section of the device data sheet for further details.