22.3 Compare Mode
The Compare mode function described in this section is available and identical for all CCP modules.
Compare mode makes use of the 16-bit odd numbered Timer resources (Timer1). The 16-bit value of the CCPRx register is constantly compared against the 16-bit value of the TMR1 register. When a match occurs, one of the following events can occur:
- Toggle the CCPx output and clear TMR1
- Toggle the CCPx output without clearing TMR1
- Set the CCPx output
- Clear the CCPx output
- Generate a Pulse output
- Generate a Pulse output and clear TMR1
The action on the pin is based on the value of the MODE control bits.
All Compare modes can generate an interrupt. When MODE = ‘b0001
or ‘b1011
, the CCP resets the TMR1 register.
The following figure shows a simplified diagram of the compare operation.