
dsPIC33F Family Reference Manual
DS70198C-page 12-6 © 2009 Microchip Technology Inc.
12.4 CAPTURE BUFFER OPERATION
The Input Capture module can select Timer2 or Timer3 as its time base. The selected timer value
is captured and stored in a four deep FIFO buffer on every capture event as shown in
Figure 12-3. The ICxBUF register provides access to the FIFO buffer as it is memory mapped.
Two status flags are associated with the FIFO buffer:
• Input Capture x Buffer Empty Status (ICBNE) flag
• Input Capture x Overflow Status (ICOV) flag
These status flags are cleared:
• On any device Reset
• When the module is disabled by the Input Capture Mode Selection (ICM<2:0>) bits
12.4.1 Input Capture Buffer Not Empty (ICBNE)
The ICBNE read-only status bit (ICxCON<3>) is set on the first input capture event and remains
set until all capture events are read from the capture buffer. For example, if three capture events
occur, then three reads of the capture buffer are required before the ICBNE (ICxCON<3>) bit is
cleared. Similarly, if four capture events occur, four reads are required to clear the bit. Each read
of the capture buffer allows the remaining word(s) to move to the next available top location.
12.4.2 Input Capture Overflow (ICOV)
The ICOV read-only status bit (ICxCON<4>) is set when the capture buffer overflows. If the event
that the buffer is full with four capture events, and a fifth capture event takes place before the
buffer is read, an overrun condition occurs, and the ICOV (ICxCON<4>) bit is set to logic ‘1’.
To clear the overrun condition, the capture buffer must be read four times. On the fourth read,
the ICOV (ICxCON<4>) status flag is cleared. The capture event does not write timer values into
the FIFO buffer when it is full.
Figure 12-3: Timer Value Capture
Note 1: The latency from the time the transition happens at the capture input (ICx pin) to the
time the capture event is generated is two instruction cycles.
2: The Overflow flag remains cleared in Edge Detect mode (ICM = 0b001).
100
200
300
400
Capture
FIFO
ICBNE
Flag is set
500
100
xxxx
xxxx
xxxx
1st Capture
Capture
Event
100
200
xxxx
xxxx
100
200
300
xxxx
100
200
300
400
2nd Capture
3rd Capture
4th Capture
TMR2
or
TMR3
100
200
300
400
5th Capture
ICOV
Flag is set
Timer is
Reset on
Period Match
Comentarios a estos manuales