1.4.3 CCP

Table 1-13. CCP Code Calculations
Modules Limit High Resolution
CCP1 16.38 ms 250 ns
Timer1/3

The CCP module can also measure the duty cycle of a waveform. This has a similar approach to section CCP.

OVERVIEW

Another method to measure the duty cycle is setting up the CCP as in section CCP , and then set the module to interrupt on 4 or 16 edges, calculate the period, and divide the two results to get the ratio.

SETUP

See the Setup portion of section CCP to get both the period and pulse width.

LIMITATIONS

Any absolute errors incurred from the pulse measurement are canceled. For best results a large number of counts should be captured during the duration of the capture. For example, the CCP must have at least 10 counts for 10% accuracy.