New lessons introducing the CCP module's capture and compare modes have been added to the Enhanced Mid-Range PIC tutorials.
So what's a CCP module?
"CCP" stands for capture, compare and PWM. It's a versatile peripheral that works with Timer1 to:
- in capture mode, accurately time external events - making it possible to, for example, measure a signal's pulse width or period
- in compare mode, automatically perform actions such a setting or toggling the state of an output pin or sampling an analog input, at a precisely scheduled time
- in PWM mode, automatically generate a stream of pulses of (usually) fixed frequency but with a variable duty cycle - useful for such things as dimming LEDs and controlling motors
What does this tutorial cover?
The CCP module is quite elaborate, so this lesson only describes the capture and compare modes, showing how they can be used for signal measurement, pulse generation, and the automatic sampling of analog inputs at regular intervals.
The next lesson (not yet available) will cover the PWM modes.
As usual, this lesson is available in assembly language and C (XC8) versions.
There is no "migrating from mid-range PIC" lesson for this topic, because the CCP modules's capture and compare modes on the PIC16F1824 used in this lesson are identical to the capture and compare modes described for the PIC16F684 in the mid-range PIC tutorials - although there are four (4) CCP modules available on the 16F1824, compared with only one on the 16F684...
How do I get it?
If you have purchased the enhanced mid-range tutorials, you will find these new lessons available for download via the “Downloads” link in your “My account” area, as usual. And if you have purchased a PIC training board, a new manual is also available for download, with the jumper settings tables (in appendix A) updated to reflect the new lessons.