32-Bit Input Capture Support
The Input Capture modes have the ability to operate with a 32-bit time base. The 32-bit
mode is selected by setting the T32 bit. All Input Capture functions are the same
between 16-bit and 32-bit modes, with these changes in 32-bit operations:
- CCPxTMR is a 32-bit register
- CCPxBUF is a 32-bit register
- The FIFO buffer only has two levels available in 32-Bit Operating mode.
Setup for Input Capture mode (Every Rising Edge) shows a typical procedure for setting up Input Capture mode.
Setup for Input Capture mode (Every Rising Edge)
CCP1CON1bits.CCSEL = 1; // Input capture mode
CCP1CON1bits.CLKSEL = 0; // Set the clock source (Tcy)
CCP1CON1bits.T32 = 0; // 16-bit Dual Timer mode
CCP1CON1bits.MOD = 1; // Capture ever rising edge of the event
CCP1CON2bits.ICS = 0; // Capture rising edge on the Pin
CCP1CON1bits.OPS = 0; // Interrupt on every input capture event
CCP1CON1bits.TMRPS = 0; // Set the clock pre-scaler (1:1)
CCP1CON1bits.ON = 1; // Enable CCP/input capture