6 Using UTMR as CCP (Capture/Compare/PWM)

The CCP (Capture/Compare) module is a peripheral which uses TMR1/TMR2 as the time base to perform Capture/Compare/PWM operations. The Capture/Compare modes use TMR1 as time base, whereas PWM mode uses TMR2 as time base. The following table shows UTMR settings in different CCP modes:

Table 6-1. UTMR Settings for Different CCP Modes
CCP MODE[3:0]CCP ModeCCP OperationUTMR Settings

If START/RESET/STOP = <blank>, set based on use case

Comments
STARTRESETSTOPOther
0001CompareToggle output; clear TMR1At PR MatchUse OM = Pulse mode and OPOL to generate appropriate output. Set/Clear/Toggle output features are not available in UTMR.
0010Toggle output
1000Set output
1001Clear output
1010Pulse outputOM = Pulse output
1011Pulse output; clear TMR1At PR MatchOM = Pulse output
0011CaptureEvery edge of CCPx inputEither ERS Edge
0100Every falling edge of CCPx inputRising ERS EdgeEPOL = Inverted
0101Every rising edge of CCPx input
0110Every 4th rising edge of CCPx inputUse CLC or NCO as a frequency divider and use that as ERS input.
0111Every 16th rising edge of CCPx input
11xxPWMPWM operationRising ERS EdgeAt Start + PR MatchAt PR Match

OM = Level output

OPOL = 0 for left-aligned PWM

OPOL = 1 for right-aligned PWM

UTMR requires a periodic ERS input to act as the PWM period. The PR value determines the PWM duty cycle.